Hi, I wonder whether someone maybe able to help me please.
I'm using the following rex to extract the word ID from a text string, which can be written in many permutations, e.g. ID, Id, id.
| rex field=text "/^|[^a-zA-Z](?<a>(?i)id)[^a-zA-Z]|$"
Could someone tell me please, is there a simpler way to write this?
Many thanks and kind regards
Chris
Thanks for sample data.
| rex field=text "\b(?i)(?id)\b"
here \b matches any position that lies at boundary of word "id"
(?i) --> case insensitive match
| rex field=text (?<!\w)(?i)(?<a>id)(?!\w)
That looks for the term id
not surrounded by other word characters.
Thanks for sample data.
| rex field=text "\b(?i)(?id)\b"
here \b matches any position that lies at boundary of word "id"
(?i) --> case insensitive match
Hi @493669, as per the solution from @wenthold, this works great and thank you for the explanation.
If you change this to an answer I can accept it.
Kind Regards
Chris
Try
| rex field=text "\b(?i)(?<a>id)\b"
Hi @wenthold, this works great, thank you very much for taking the time to put this together.
Many thanks and kind regards
Chris
Can you add some sample data?
| rex field=text "\s(?i)(?<a>id)\s"
it will match word ID(case insensitive) from a text string
Hi @493669, thank you for this.
It certainly extracts the correct words in the different formats, but unfortunately if there is a succeeding special character such a s a . or ) it doesn't extract the word.
Many thanks and kind regards
Chris
Can you try below
| rex field=text "\s(?i)(?<a>id)."
Hi, thank you for coming back to me with this.
I'm sorry this has a similar issue in that it extracts id from the word "identity".
Many thanks and kind regards
Chris
If it helps, here is sample data where id should not be extracted:
The first part of registration was
straight forward but I have been left
confused as to if the process was
completed or not ? when I tried to
continue the system did not recognise
my identity ?
Regards
Chris
This will place any single combination of ( ID
, iD
, Id
, or id
) that is found in field text
into field a
, if that is what you want.
| rex field=text "(?i)(?<a>id)"
Hi, thank you for this @DalJeanis, but unfortunately it doesn't quite work because it extracts the id from words such as "said".
Many thanks and kind regards
Chris