Jump to content
UBot Underground

RegEx that functions like $Page Scrape


Recommended Posts

I'm trying to create a RegEx function that will work like the $Page Scrape function. I like the $Page Scrape's ability to select the text to the left and right of the target to scrape the appropriate info, unfortunately it can only be used on web pages. I want to create a regex to do the same thing to a list item.

 

I'm trying $Replace Regular Expression to replace from beginning of list item to a set word or phrase, replacing with $Nothing to get rid of the data prior to the target. Then trying a $Replace Regular Expression to replace the characters immediately after the target until the end of the list item with $Nothing.

 

Unfortunately I can't seem to get the RegEx just right to perform this consistently.

 

Any gurus here want to show how it's done?

Link to post
Share on other sites
  • 1 month later...

Regex is so interesting. When I use .*(?=-) as you suggested, it works perfectly (thanks!) until I come across more than one "-" such as "John Doe - ABC - 123". With the suggested regex I then end up with "John Doe - ABC" so I guess that regex finds the last instance of the main expression, instead of the first.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...