04-24-2015, 03:38 PM
With regards to regex, it's not really that useful to know more than the basics. I only tend to use things like:
Any digit: \d
Any letter: \w
Any single char: .
Character escape: \
Any three digits: \d{3}
Any amount of digits: \d*
Three to nine letters: \w{3,9}
Three or more of any letter: \w{3,}
The case-sensitive word "fArTe": fArTe
The case-insensitive word "FaRtE": [Ff][Aa][Rr][Tt][Ee]
Only the case-sensitive words "fArTe" and "FaRtE": fArTe|FaRtE
A letter in the range from a to f, and a number in the range from 7 to 9: [a-f][7-9]
NOT a letter in the range from a to f, and a number in the range from 7 to 9: [^a-f][^7-9]
I really don't use more than these. For instance: /.*[Ff][Aa][Rr][Tt][Ee]-\d{3}.*/ will match and return any sequence of any characters that include the pattern of a case-insensitive word farte, a dash, and any 3 digits. Say, afs45ak-3SAsjffartE-420, would return but, fasdj hfksf FARTE-4200 asbut, wouldn't.
Any digit: \d
Any letter: \w
Any single char: .
Character escape: \
Any three digits: \d{3}
Any amount of digits: \d*
Three to nine letters: \w{3,9}
Three or more of any letter: \w{3,}
The case-sensitive word "fArTe": fArTe
The case-insensitive word "FaRtE": [Ff][Aa][Rr][Tt][Ee]
Only the case-sensitive words "fArTe" and "FaRtE": fArTe|FaRtE
A letter in the range from a to f, and a number in the range from 7 to 9: [a-f][7-9]
NOT a letter in the range from a to f, and a number in the range from 7 to 9: [^a-f][^7-9]
I really don't use more than these. For instance: /.*[Ff][Aa][Rr][Tt][Ee]-\d{3}.*/ will match and return any sequence of any characters that include the pattern of a case-insensitive word farte, a dash, and any 3 digits. Say, afs45ak-3SAsjffartE-420, would return but, fasdj hfksf FARTE-4200 asbut, wouldn't.