SimpleRegex/SRL-PHP

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

Opened this issue · 2 comments

syrm commented

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.

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

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