Reputation: 148
Can anybody tell me what does this regular expression identifies : (?![^&;]+;)(?!<[^<>]*)
and (?![^<>]*>)(?![^&;]+;)
.
Thanks.
Upvotes: 2
Views: 178
Reputation: 26930
First one :
"
(?! # Assert that it is impossible to match the regex below starting at this position (negative lookahead)
[^&;] # Match a single character NOT present in the list “&;”
+ # Between one and unlimited times, as many times as possible, giving back as needed (greedy)
; # Match the character “;” literally
)
(?! # Assert that it is impossible to match the regex below starting at this position (negative lookahead)
< # Match the character “<” literally
[^<>] # Match a single character NOT present in the list “<>”
* # Between zero and unlimited times, as many times as possible, giving back as needed (greedy)
)
"
Second one :
"
(?! # Assert that it is impossible to match the regex below starting at this position (negative lookahead)
[^<>] # Match a single character NOT present in the list “<>”
* # Between zero and unlimited times, as many times as possible, giving back as needed (greedy)
> # Match the character “>” literally
)
(?! # Assert that it is impossible to match the regex below starting at this position (negative lookahead)
[^&;] # Match a single character NOT present in the list “&;”
+ # Between one and unlimited times, as many times as possible, giving back as needed (greedy)
; # Match the character “;” literally
)
"
Note that both of those expressions do not actually capture anything at all but they are probably used to pinpoint a position inside the string. Without any context is hard to tell exactly where they are used.
Upvotes: 5