Solved

Can't get simple regular expression to work


Badge

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

 

icon

Best answer by gazza 22 May 2021, 01:02

View original

6 replies

Badge +5

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

^A-|^C-

 

Badge +5

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 -

Badge

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.

Badge +5

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.

 

Badge

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.

Badge +5

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.

Reply