APTS 3 Posted May 4, 2016 Report Share Posted May 4, 2016 I am trying to scrape the data at the end of each of these comma-separated strings. Each string has different segments that are separated by pipes. Here is my sample data: "|35 CHESTNUT PARK RD |CITY OF TORONTO|5300000|2014\/11|43.679108|-79.386780|190410123000100|3977000|PLAN 233E LOT 3|", "|39 CHESTNUT PARK RD |CITY OF TORONTO|2000000|2004\/04|43.679179|-79.386542|190410123000200|4106000|PLAN 233E LOT 4|", "|43 CHESTNUT PARK RD |CITY OF TORONTO|1847625|1997\/11|43.679223|-79.386343|190410123000300|4279000|PLAN 233E LOT 5|" The data that I want to scrape is: PLAN 233E LOT 3 PLAN 233E LOT 4 PLAN 233E LOT 5I have been playing with this in the Regex Editor but so far I have not been able to figure out the correct regex pattern to grab the data I want. This is the pattern that I have been playing with, but it is not working: (?<=\W)([A-Z])\w+ Can someone give me a hand with figuring out the correct regex pattern to scrape the desired data? Thank you. Quote Link to post Share on other sites
pash 504 Posted May 4, 2016 Report Share Posted May 4, 2016 PLAN.*\d+ Quote Link to post Share on other sites
pash 504 Posted May 4, 2016 Report Share Posted May 4, 2016 or set(#text,"\"|35 CHESTNUT PARK RD |CITY OF TORONTO|5300000|2014\\/11|43.679108|-79.386780|190410123000100|3977000|PLAN 233E LOT 3|\", \"|39 CHESTNUT PARK RD |CITY OF TORONTO|2000000|2004\\/04|43.679179|-79.386542|190410123000200|4106000|PLAN 233E LOT 4|\", \"|43 CHESTNUT PARK RD |CITY OF TORONTO|1847625|1997\\/11|43.679223|-79.386343|190410123000300|4279000|PLAN 233E LOT 5|\"","Global") set(#text,$replace regular expression(#text,"(\\|\",|\\|\")",""),"Global") set(#text,$replace regular expression(#text,".*\\|",""),"Global") stop script set(#text,$replace regular expression($replace regular expression(#text,"(\\|\",|\\|\")",""),".*\\|",""),"Global") 1 Quote Link to post Share on other sites
APTS 3 Posted May 4, 2016 Author Report Share Posted May 4, 2016 Thanks for the help Pash. Your code works on the sample data, but what about when the sample data is like this: "|35 CHESTNUT PARK RD |CITY OF TORONTO|5300000|2014\/11|43.679108|-79.386780|190410123000100|3977000|PLAN R32263E LOT 3C|", "|39 CHESTNUT PARK RD |CITY OF TORONTO|2000000|2004\/04|43.679179|-79.386542|190410123000200|4106000|LOT 23RE AREA 4A|", "|43 CHESTNUT PARK RD |CITY OF TORONTO|1847625|1997\/11|43.679223|-79.386343|190410123000300|4279000|42R624 26y33E LOTS 55T|"The last segment of data can contain a mix of letters and numbers and spaces, of varying length. Quote Link to post Share on other sites
pash 504 Posted May 4, 2016 Report Share Posted May 4, 2016 Thanks for the help Pash. Your code works on the sample data, but what about when the sample data is like this: "|35 CHESTNUT PARK RD |CITY OF TORONTO|5300000|2014\/11|43.679108|-79.386780|190410123000100|3977000|PLAN R32263E LOT 3C|", "|39 CHESTNUT PARK RD |CITY OF TORONTO|2000000|2004\/04|43.679179|-79.386542|190410123000200|4106000|LOT 23RE AREA 4A|", "|43 CHESTNUT PARK RD |CITY OF TORONTO|1847625|1997\/11|43.679223|-79.386343|190410123000300|4279000|42R624 26y33E LOTS 55T|"The last segment of data can contain a mix of letters and numbers and spaces, of varying length. set(#text,"\"|35 CHESTNUT PARK RD |CITY OF TORONTO|5300000|2014\\/11|43.679108|-79.386780|190410123000100|3977000|PLAN 233E LOT 3|\", \"|39 CHESTNUT PARK RD |CITY OF TORONTO|2000000|2004\\/04|43.679179|-79.386542|190410123000200|4106000|PLAN 233E LOT 4|\", \"|43 CHESTNUT PARK RD |CITY OF TORONTO|1847625|1997\\/11|43.679223|-79.386343|190410123000300|4279000|PLAN 233E LOT 5|\" \"|35 CHESTNUT PARK RD |CITY OF TORONTO|5300000|2014\\/11|43.679108|-79.386780|190410123000100|3977000|PLAN R32263E LOT 3C|\", \"|39 CHESTNUT PARK RD |CITY OF TORONTO|2000000|2004\\/04|43.679179|-79.386542|190410123000200|4106000|LOT 23RE AREA 4A|\", \"|43 CHESTNUT PARK RD |CITY OF TORONTO|1847625|1997\\/11|43.679223|-79.386343|190410123000300|4279000|42R624 26y33E LOTS 55T|\"","Global") set(#text,$replace regular expression(#text,"(\\|\",|\\|\")",""),"Global") set(#text,$replace regular expression(#text,".*\\|",""),"Global") alert(#text) Quote Link to post Share on other sites
pablo322 1 Posted June 6, 2016 Report Share Posted June 6, 2016 set(#text,"\"|35 CHESTNUT PARK RD |CITY OF TORONTO|5300000|2014\\/11|43.679108|-79.386780|190410123000100|3977000|PLAN 233E LOT 3|\", \"|39 CHESTNUT PARK RD |CITY OF TORONTO|2000000|2004\\/04|43.679179|-79.386542|190410123000200|4106000|PLAN 233E LOT 4|\", \"|43 CHESTNUT PARK RD |CITY OF TORONTO|1847625|1997\\/11|43.679223|-79.386343|190410123000300|4279000|PLAN 233E LOT 5|\" \"|35 CHESTNUT PARK RD |CITY OF TORONTO|5300000|2014\\/11|43.679108|-79.386780|190410123000100|3977000|PLAN R32263E LOT 3C|\", \"|39 CHESTNUT PARK RD |CITY OF TORONTO|2000000|2004\\/04|43.679179|-79.386542|190410123000200|4106000|LOT 23RE AREA 4A|\", \"|43 CHESTNUT PARK RD |CITY OF TORONTO|1847625|1997\\/11|43.679223|-79.386343|190410123000300|4279000|42R624 26y33E LOTS 55T|\"","Global") set(#text,$replace regular expression(#text,"(\\|\",|\\|\")",""),"Global") set(#text,$replace regular expression(#text,".*\\|",""),"Global") alert(#text) hello PM please 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.