I have a pattern that looks like this:
pattern = '.*class=(.*)'
and it gives me the result something like this:
my_class=Hello
your_class=Hi
fclass=FHello
class=That's What I need
Basically I want to say that I need to return a string that contains class only, and not some fclass my_class and so on
If you’re running the regex on individual lines, you can use the
^symbol to target the beginning of a regex:If not, word boundaries might be helpful: