Alteryx Designer Desktop Discussions

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

Two Regex Questions

jay_hl
7 - Meteor

Hello

 

I have two different regex asks (to be used in different tools of the workflow).

 

1. Firstly using Regex_Match, to filter out a strings which either start with a lowercase letter, or any word witin the string begins with a lowercase letter (e.g a lowercase letter after any space within the field).

2. To use Regex_Replace to remove any numbers/digits from within a string, and only leave the letters and special characters remain.

 

Thanks for your help in advance

 

Jay

4 REPLIES 4
DataNath
17 - Castor
17 - Castor

Hi @jay_hl, you can use the following for the first and second cases respectively:

 

REGEX_CountMatches([Input], "^[a-z]|\s[a-z]", 0) = 0

 

REGEX_Replace([Input], "\d", "")

 

Just replace [Input] with your actual field of course. For the first use case, the records you want to keep will come out of the top (True) anchor and those you're disposing of will be in the bottom (False) anchor. Hope this helps!

jay_hl
7 - Meteor

Thanks.  The second works for me, but the first doesnt.  I seem to get most of my records matching, but am after those that either start with a lowercase letter, or have a lowercase letter after any space.

 

Appreciate the support

 

Jay 

daryllj
7 - Meteor

Hi @jay_hl 

How about these expressions?

REGEX_MATCH([Text], "^[a-z].*|.*\b[a-z].*", 0)
REGEX_REPLACE([Text], "\d", "")

 

Screenshot 2025-04-21 153247.jpg

 

 

jay_hl
7 - Meteor

thanks all.  appreciated

Labels
Top Solution Authors