Hi,
I have a field value as below.
These are all fixed positions all across.
/COMPANY LOCATIONS/PA/PHILADELPHIA/ABC - PHILADELPHIA/
I need two regex:
Thanks in advance!!!
After banging my head for a bit, I coded below run any where and it worked!!! 🙂
| gentimes start=-1
| eval Location="/COMPANY LOCATIONS/PA/PHILADELPHIA/ABC - PHILADELPHIA/"
| table Location
| rex field=Location "^(?:[^\/\n]*\/){2}(?P<State>\w+)\/(?P<City>[^\/]+)\/(?P<Code>[^\/]+)"
Like this:
| makeresults
| eval _raw="/COMPANY LOCATIONS/PA/PHILADELPHIA/ABC - PHILADELPHIA/"
| rex "^\/(?<WHATEVER>[^\/]+)\/(?<LOCATION>[^\/]+)\/(?<STATE>[^\/]+)\/(?<CITY>[^\/]+)\/"
I am not sure what is supposed to be CODE
... ?
After banging my head for a bit, I coded below run any where and it worked!!! 🙂
| gentimes start=-1
| eval Location="/COMPANY LOCATIONS/PA/PHILADELPHIA/ABC - PHILADELPHIA/"
| table Location
| rex field=Location "^(?:[^\/\n]*\/){2}(?P<State>\w+)\/(?P<City>[^\/]+)\/(?P<Code>[^\/]+)"
Could you please provide some more sample inputs and the expected output. For example, when you say you need LOCATION, STATE, CITY, CODE, what values should each of these hold with respect to your sample data?
Hi Arjun. See my own answer to my own question. Took some head bangs at this time of Friday! 🙂