I have the following values in the field and need to write regex for this.
Regex :(?P\d\,\d\d\d)
Input
9
19
157
1,500
Now the issue is I don't want "," to appear in the output field.
Expected output
9
19
157
1500
I am not able to find the expression to ignore the ",".
Kindly advise.
If you have already regexed out your number in a field say "myNumberField" or the data with "," is in "myNumberField" then can you try this which will remove the "," from the field value:
your query to return myNumberField
| rex mode=sed field=myNumberField "s/,//g"
| table myNumberField
The issue is i need to write this in myscript and I can only write regex expression there. So, can't write the mode.
what script are you writing? does that scripting means doesn't give something locally for you to capture with comma first and then replace in consecutive lines of script?
Can you paste the sample code that you have written and what are trying you achieving out of it so to see if we can help.
In the script, i will be using this to get the count of the events, which is being processed further.
It is easier to write capture values before and after comma in the regex and merge and use it in the script. But since this is being used for all the sourcetypes and I don't want to update script everywhere.
I am trying to look for options where I can handle it in a single regex, just be eliminating the comma.