Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

RegEx Parsing using ? and clarification

Hello Community,

 

I have encountered an issue when parsing through data using RegEx. When I use the lazy qualifier ? (question mark) and then I have to use parenthesis to specify the end of the qualifier, certain symbols like parenthesis and some other odd characters cannot be captured in the expression. For example, if I was to parse the following

 

atk)kisnba
dsdbbaj)nbjsbga
sa)irsanso

 

using the following expression:

 

(.+?)(?=))\.(.+)

 

the parse would not work due to there being an end parenthesis needed to parse. I understand there are other solutions to this simple example I have provided, but in a situation where an odd character that can only be specified in a lazy quantifier is needed to parse data, how can I use it in a lazy quantifying expression? Is there perhaps a better way to parse data that uses these odd characters?

 

Thanks!

 

Bryce

1 REPLY 1
Carolyn
11 - Bolide

Hi Bryce!

 

I think you're missing a \  to indicate that the ) is part of the data you're trying to parse, vs closing out a section. 

 

I wasn't clear on exactly how you're trying to parse it, but I was able to get this to separate the text into 2 groups, split at the )

 

 

 

(.+\))(.+)

 

 

 

2024-07-10_14-17-41.png

I'm a fan of using \W to indicate "non-word character", which will exclude letters and numbers and underscores. When I have random special characters that vary in a string of text, I've had good success with the \W

 

 

 

(\w+\W)(\w+)

 

 

Edit: I hope that helps! If not, can you provide an example of how you want the parsed data to look? 

 

It also could be that you're running into issues because you're saying "the special character may or may not be there, and there's letters before and after" so RegEx is struggling with the "may or may not be there" since if it's not there, there wouldn't be a way for it to tell that that's where the split should be.

Labels