New answers tagged regular-expressions
Here are some points you should take in consideration: Readability: long regular expressions are difficult to understand. Use comments (and eventually break one long expression into several small ones, if possible) to make it easier to read. At the same time, the piece of PHP code in your question can (and should) be refactored to make it more readable. ...
I believe the answer to my question is actually quite simple.. take the string, divide it into 2 pieces and then compare the pieces.. if they match then it contains repeated content, if not then it doesn't. Eg: This is a repeating string. This is a repeating string. becomes: a = This is a repeating string. b = This is a repeating string. ...
The given language amounts to "any bit string with at least one 1 in it", so your guesses are correct. Option 4 is equivalent because union is symmetrical, so (0 + 1) is equivalent to (1 + 0). Option 2 is equivalent because however you expand the iterations in option 2, you can just expand the iterations in the given regex once more to make up the ...
An answer from SO. http://stackoverflow.com/questions/233243/how-to-check-that-a-string-is-a-palindrome-using-regular-expressions I played around with these, and I had some success. (.?)(.?)(.?)(.?)(.?).?\5\4\3\2\1 \W(.?)(.?)(.?)(.?)(.?).?\5\4\3\2\1\W I think the real answer is that RE is a poor method for finding palindromes.
Top 50 recent answers are included