Quote:
Originally Posted by skil-phil
What am I missing?
Thanks
|
A '+' sign.
In Regex, + means "ONE OR MORE of the previous thing".
- \w = any word or number character
- \w+ = ONE OR MORE of any word or number character
Or:
- [a-zA-Z0-9] = Look for a lowercase "a through z", capital "A through Z", or number "0 through 9".
- [a-zA-Z0-9]+ = Look for ONE OR MORE of lowercase...
You also have other symbols/methods too:
- \w* = ZERO OR MORE of...
- \w? = ZERO OR ONE of...
- \w{4} = EXACTLY 4 of...
- \w{3,10} = Anywhere between 3 to 10 of...
- - -
Side Note: I'd highly recommend looking at some of my step-by-step breakdowns of regex over the years...
Here's a few of them:
I explain what each piece does, and many times, I even color-coordinate everything with colors to make it easier to understand which piece does what.
You may also want to type this into your favorite search engine:
Code:
Tex2002ans regular expressions site:mobileread.com
Tex2002ans regular expressions site:reddit.com
I've written hundreds of posts over the years about regex.