Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

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

Regex

Sarath27
8 - Asteroid

Hi All,

 

I want to write a regex to find a string which starts and ends with an alphabets. Please assist.

 

Eg.

 

EUR.ESTR.1B

EURCORPCORE23ATOA

ESGC

EM_USD_IG

 

 

6 REPLIES 6
Hammad_Rashid
11 - Bolide

^[A-Za-z].*[A-Za-z]$

 

Here's a breakdown of the pattern:

  • ^: Asserts the start of the line.
  • [A-Za-z]: Matches any alphabet (uppercase or lowercase).
  • .*: Matches any character (except for a newline) zero or more times.
  • [A-Za-z]: Matches any alphabet again.
  • $: Asserts the end of the line.

This pattern ensures that the string starts and ends with alphabets.

sparksun
11 - Bolide

REGEX_Match([Field], "^[[:alpha:]].*[[:alpha:]]$")

Try this one and see if it works for u.

aatalai
14 - Magnetar

Another way is to create a new field push it through data cleanese say remove punctuation, numbers etc (everything but letters); then use this formula

 

left([field],1) =left([new field]) and  right([field],1) =right([new field]) , if true then starts and end with an alphabet character but @Sarath27 that would be not using regex

Sarath27
8 - Asteroid

Thanks this works !!

 

Could you please help me for this as well?

 

String starts and ends with a numeric.

 

Eg

912810FT0

91282CDK4

91282CGM7

 

sparksun
11 - Bolide

REGEX_Match([Field], "^\d.*\d$")

anjelabugarin
5 - Atom

You can try this regex solution:

 

REGEX_Match([A], "^[0-9].*[0-9]$")

 




Workflow:

 

Labels