Hi, I have an address where in various spot the instead of an address I get something like 'A' or 'AAAAA.' I've tried using a regex_replace(address, (A*), "") but it ends up getting right of every 'A.' What I'd like is for it to leave the field blank if there are only 'A' s in it. Is there a way to remove the 'A's?
Thank you,
Brad
Solved! Go to Solution.
Try this ....
regex_match([Text],"a{1,}?")
Cheers,
Mark
Awesome! Thanks! New to the regex thing. Making my way.
Can you explain the "a{1,}?" part? I understand a is the letter I'm looking for and {1,} would be starting at the beginning and going to whenever? what does the '?' do?
Thanks!
BRad
a{1,} is looking for 1 or more a's
? is looking for 0, 1 or more occurrences of the preceding argument.
i tried the combination and got lucky on my first try :)
Cheers,
Mark
For completeness sake:.
? is 0 or 1 of something. "a?bc" will match "abc" and "bc" but not "aabc". Same as a{0,1}bc
+ is 1 or more of something. "a+bc" will match "abc" and "aabc" but not "bc". Same as a{0,1}bc
* is 0 or more of something. "a*bc" will match "abc" and "aabc" and "bc". Same as a{0,}bc
Try http://regexr.com/ for testing out regular expressions - its really helpful.
Wow! The RegExr is awesome. It's really helping with my data prepping! Thanks for the tip!
Brad