Skip to main content
Solved

Can't get simple regular expression to work


Forum|alt.badge.img

Dear smarter people than me -

I have a cad files with layers that start with either A- or C- and then one basemap layer called Mad_PARCELS. In my reader I only want to read the A- and C- layers. How would I query this out in the Merge feature type using regular expression. Or how do you combing two wildcard expressions? I can't really find any good documentation on regular expression examples. TIA

 

Best answer by gazza

candimk wrote:

Thanks!

Neither of those worked (nothing passed through). I tried those (or something similar, I don't remember, I tried probably 50 different iterations before posting). So there must be something else going on with my workbench (or my source DWG). But I at least know I was on the right track now, so I can go back and see what else it going on in that workbench, or at least break it down step by step.

I appreciate the quick response.

I think I have it:

 

^[AC]-\\S+

 

This means, Starts with A or C, followed by -, followed by any number of other characters.

 

View original
Did this help you find an answer to your question?

6 replies

gazza
Contributor
Forum|alt.badge.img+6
  • Contributor
  • May 20, 2021

With RegEx a ^ means start of string and a | means OR, so you probably want something like:

^A-|^C-

 


gazza
Contributor
Forum|alt.badge.img+6
  • Contributor
  • May 20, 2021
gazza wrote:

With RegEx a ^ means start of string and a | means OR, so you probably want something like:

^A-|^C-

 

Or you could use:

^[AC]-

which means, start of the string is either an A or a C then a -


Forum|alt.badge.img
  • Author
  • May 21, 2021

Thanks!

Neither of those worked (nothing passed through). I tried those (or something similar, I don't remember, I tried probably 50 different iterations before posting). So there must be something else going on with my workbench (or my source DWG). But I at least know I was on the right track now, so I can go back and see what else it going on in that workbench, or at least break it down step by step.

I appreciate the quick response.


gazza
Contributor
Forum|alt.badge.img+6
  • Contributor
  • Best Answer
  • May 21, 2021
candimk wrote:

Thanks!

Neither of those worked (nothing passed through). I tried those (or something similar, I don't remember, I tried probably 50 different iterations before posting). So there must be something else going on with my workbench (or my source DWG). But I at least know I was on the right track now, so I can go back and see what else it going on in that workbench, or at least break it down step by step.

I appreciate the quick response.

I think I have it:

 

^[AC]-\\S+

 

This means, Starts with A or C, followed by -, followed by any number of other characters.

 


Forum|alt.badge.img
  • Author
  • May 24, 2021
gazza wrote:

I think I have it:

 

^[AC]-\\S+

 

This means, Starts with A or C, followed by -, followed by any number of other characters.

 

Thanks so much for the additional research on this. This did work. I ended up just doing a tester to remove that one layer, but it takes so long to go through the 60K features on that one layer. I tested and it reads this way soooo much faster, so I really appreciate that, I don't think I would have gotten that one.


gazza
Contributor
Forum|alt.badge.img+6
  • Contributor
  • May 24, 2021
gazza wrote:

I think I have it:

 

^[AC]-\\S+

 

This means, Starts with A or C, followed by -, followed by any number of other characters.

 

You are welcome, glad it works. The trick was that the RegEx needs to match the entire layer name not just the first few characters.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings