wiremarket 1 Posted April 5, 2013 Report Share Posted April 5, 2013 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? Quote Link to post Share on other sites
wiremarket 1 Posted April 7, 2013 Author Report Share Posted April 7, 2013 Very nice! I'll be giving this a try in the morning. Thanks! Quote Link to post Share on other sites
wiremarket 1 Posted May 24, 2013 Author Report Share Posted May 24, 2013 I've been playing with those today, and not having much luck. If I want to find everything before a "-" in a variable, why wouldn't (?<=-) work? Quote Link to post Share on other sites
wiremarket 1 Posted May 25, 2013 Author Report Share Posted May 25, 2013 Ah there we go, works perfect! I had tried adding the .* but had it in slightly wrong place. Thanks willywonka! Quote Link to post Share on other sites
wiremarket 1 Posted May 25, 2013 Author Report Share Posted May 25, 2013 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. Quote Link to post Share on other sites
HelloInsomnia 1103 Posted May 25, 2013 Report Share Posted May 25, 2013 Do you have an example of say a full line? What are you trying to get that out of? Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.