#regex heelp

1 messages · Page 1 of 1 (latest)

quartz schooner
#

I only want to find all matches for @XXXX</span>. I have this string <span class='username'><a href=''>@fivenine</a></span>, so in this case, it should not detect @fivenine</a></span> because there's </a> before the closing span tag.
My regex looks like this at the moment, @\S*<\/span>

zinc schooner
#

the * is eating that closing link tag LOL

#

what if the username is nt314p</a>

#

@quartz schooner

quartz schooner
#

oh uh

quartz schooner
zinc schooner
#

yummmm

quartz schooner
#

woah how

zinc schooner
#

Complete the microtransaction $2.99

quartz schooner
#

this did not work like i wanted it to KEK

zinc schooner
#

LOLLL dude

#

what characters can a username contain?

#

alphanumeric?

quartz schooner
#

yes

zinc schooner
#

\@[\w\d]+<\/span>

quartz schooner
#

oh bruh that simple KEK

zinc schooner
#

\w -> any word character
\d -> any digit character
[ ... ] a single character of the set ...

  • -> one or more of the character set
quartz schooner
#

thanks LUL
i was trying to make it exclude a pattern

zinc schooner
#

don't work hard work smart

quartz schooner
#

is it even possible to make something that excludes a pattern?

zinc schooner
#

but i have like zero regex experience

quartz schooner
#

cuz i could only find a way to make it exclude a single letter Hmm

quartz schooner
#

thanks a lot tho

zinc schooner
#

npnp

quartz schooner
#

uh sorry for ping
i figured it out, we just add _ to the list duh

zinc schooner
#

what's this for btw

#

what happened to your other project

quartz schooner
#

this just some web scraping for work lol
still working slowly on other project when i get time XD

zinc schooner
#

actually i can't discuss what i did in the past here kekleo

quartz schooner
wanton jackal