Skip to main content
Solved

Can't get simple regular expression to work

  • May 20, 2021
  • 6 replies
  • 30 views

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

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.

 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

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

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

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

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

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.