How do you write a regular expression to extract a field which has characters, numbers and also special characters? There are sometimes spaces in between.
I tried this. rex "(?\w+[A-Z0-9][^-])" --- to include characters and hyphen,
but it doesnt work
Thanks in advance!!
Hi @Deepz2612
Try this, I included space and hyphen
([A-Za-z0-9*,\s-])
this works for me :-
[\w\D]*
It would be better if you give the input data as well
hi @Deepz2612 ,
you can try this,
| rex "(?P<field_name>[a-zA-Z0-9\s].*)"
Hi @Deepz2612 ,
I tried this:-
([\w\D]+) for extracting "tirx-Ten @140gmail.com"
Thanks
\w includes digits, \D is non-digits. So combining those two means you match basically anything.
It would help if you would post some sample data and requirements on what you need to extract.
Regarding the regex you have: put it in on regex101.com and see the explanation of what it does, maybe that helps you spot the flaw.
Also: when posting code like that, please put it in between backticks: ` or use the 101010 button in the message editor toolbar to post it as a code snippet, so special characters don't disappear.
Hi @Deepz2612
Try this, I included space and hyphen
([A-Za-z0-9*,\s-])