SimpleRegex / SRL-PHP

Simple Regex Language
https://simple-regex.com
MIT License
1.8k stars 112 forks source link

Can't do this ((data-id)="|src=") ? #46

Open syrm opened 7 years ago

syrm commented 7 years ago

I am wrong or i can't do this regex : ((data-id)="|src=") I tried lots of thing, my last attempt is this one :

capture ( any of ( ( capture(literally 'data-id'), literally '="' ), (literally 'src="') ) )

The SRL Query contains an error: Non-matching parenthesis found.

KarimGeiger commented 7 years ago

Hi,

thanks for your comment. Yes, it seems like this indeed doesn't work, as it will treat any of the statements in the "any of" group equally and gets confused by the parenthesis around the inner two conditions.

The closest I can get is

capture (
  any of (
    capture(literally 'data-id'), literally '="',
    literally 'src="'
  )
)

which of course isn't right. Maybe working with quantifiers helps to find a way around, but this shouldn't be the case. I'll have a look at it.

syrm commented 7 years ago

I tried to find a solution with quantifier, but can't found a solution either.