Thursday 31 January 2019

regex - Regular Expressions AND

I am really not good with regular expressions and I come here for some assistance :). I am trying to combine regular expressions with something like AND. For example if we have a text file with:



abc1-xyz

abc1-ertxyz


abc1xyz

postxyz

abc1


I would like to match everything that starts with "abc1" AND also contains the letters "xyz" somewhere.



I know that I can start with:




/^abc1/


but I am not sure how to combine so it can also match to contain "xyz".



Thank you for your assistance in advance.

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...