Regex Post-processing function can be used to extract the string in our extracted field result. For example, I have this scraping agent “Regex Function Example(Post-Processing)” in my account and I want to extract state from City field. Here, we can use the Regex
Post-processing function to extract the state from City field.
Before
Steps
-
Edit the scraping agent by clicking on the Edit tab
-
Add a new field, name it something like me named it State and selector will be same as for City field
-
Now, click on the Add Post-Processing button to add the
Regex
Post-Processing function, The below dialog box will appear -
Now, enter the Regular expression as
[^,]+,\s*(.*)
in Expression parameter and enter the Group index as (1
)in Group parameter which shown in above screenshot. -
Then, Save the function and the scraping agent configuration
-
And finally, re-run you agent to apply the changes.
After Regex Function
Now, if we notice the screenshot below, we find the new field State with the updated result.