Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[solved] Regex fail - "(?<=href)(.*?)(?=class)"
#1
This should be easy, but I can't figure it out. I'm just trying to get the content between the words a href and class. I lost my code due to a ssd death....Sad

The simple version, "(?<=href)(.*?)(?=class)", fails...

the version I actually want is the following (grabs a url)

s pattern="(?<=<a href=.)(.*?)(?=.class)"

the . after href and before class are to match any character since I don't know how to escape a " character.

Thanks.
#2
pattern="(?=http://www.domain.com/video)(.*?)(?=..class=)"

I had to change the preceded by code from (?<=) to (?=)

No idea why this would work, but it does.


Forum Jump:


Users browsing this thread: 1 Guest(s)