Alteryx Designer Desktop Discussions

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

How can I extract all elements of a string after a certain phrase using RegEx?

ashley_harris
7 - Meteor

I am reading data from a MongoDB collection, and part of the output looks like this:

 

InternalFileNameFileBYIndex,Sex - Main

 

How would I use RegEx to extract all text after the "Index" text (including this word). I have tried to extract the text after ¿ but I get weird results, and don't understand RegEx enough to know the syntax needed.

 

Thanks in advance!

2 REPLIES 2
DataNath
17 - Castor

Hey @ashley_harris, is this pattern consistent? Just wondering as, if not, that's maybe why you're getting weird results and if so it'd be great if you could provide some other examples of possible strings so we can set up a more specific expression.

 

The following works for your example (I've added 'Index' to the capture group to make it a bit more specific in case there are other instances of '¿...', but if it's only ever '¿' followed by what you want then you can just remove 'Index' from inside the brackets so it's solely '.*'):

 

 

¿(Index.*)

 

 

DataNath_0-1657718797345.png

ashley_harris
7 - Meteor

That works perfectly, thank you so much! I think you are right, some of the data in the collection is a weird format, which must have been why I was getting weird results.

 

 

Labels