php - using regex to skip ahead all characters until a specific sequence of letters is found using negative lookahead -
I'm fine with basic regular expressions, but I have to show a few forward / back behind Poiss / Dag.
I'm trying to drag it by ID:
[keyword stuff = otherstuff id = 123 morestuff = stuff]
can be in unlimited quantity Before or after "luggage" I am using the Regox Coach which I have tried to help debug, but I'm not moving anymore ...
So far my The pass is:
[[keyword (? :: id = ([0-9] +))? [^ \]] * \] takes care of any additional features after the id, but I can not understand how to ignore everything between the keyword and the id. I Know that I can not go to [^ id] * , I believe I need to use a negative lookout like this (?! Id) * But I think because it does not work beyond zero-width, it does not work either:
\ [keyword [a-z0-9 =] * (?! Id) (?: Id = ([0-9] +))? [^ \]] * \] I was looking for examples for everything but I could not find any one. Or maybe I have it, but they have gone so far on my head. I do not know what they were.
Help! Thank you.
EDIT: It must also be matched with [keyword stuff = other staff], where ID = is not present at all, so I should have 1 or 0 on the ID # group. There are also other [otherkeywords id = 32] which I do not want to match. The document needs to match many of the documents [keyword id = 3] using preg_match_all.
No letterhead / back requirement:
/ \ [keyword (?: [^ \]] *? \ Bid = ([0- 9] +)) [^ \]] *? \] / '[^]] *]' added to check an actual tag end, may be unnecessary.
Edit: \ b is added as an ID, otherwise it may match
Comments
Post a Comment