regex - perl regular expression -
i having urls in format. urls contain &abc=4 , not.
xxxxxxxxxxxxxxxxxxxxxxxxxxx&abc=4 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&abc=4 xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxx here xxxxxxxxxxxxxxxxxxxxx string
i want match urls have xxxxxxxxxxxxxxxxx , not &abc=4(meaning want these type of urls, xxxxxxxxxxxxxx, xxxxxxxxxxxxxx, xxx)
i know how write regular expression matches entire url. example: /x.*abc=4/
but how write regular expression matches xxxxxxxxxx , not &abc=4?
i use negative look-ahead assertion (look ahead not allowed follow pattern)
^(?!.*&abc=4$).*$ this pattern match string not end &abc=4
you can verify online here: http://www.rubular.com/
Comments
Post a Comment