Jump to content
UBot Underground

Need Help With Regex Editor


Recommended Posts

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 5

I 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.

Link to post
Share on other sites

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")
  • Like 1
Link to post
Share on other sites

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.

Link to post
Share on other sites

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)
Link to post
Share on other sites
  • 1 month later...
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

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...