In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Regex to get string before and after a hyphen

aehrenwo
11 - Bolide

I am trying to isolate text that can appear in the following format in a string field. 

 

7-23 or 100-22 or 17-23 --- so the text before the hyphen can be 1 or 3 digits, and the text after is a two-digit number with spaces on either side. 

 

I am hoping the regex for this is relatively simple, but not finding examples when searching. 

4 REPLIES 4
Raj
16 - Nebula

Can you share sample input and outputs.

aehrenwo
11 - Bolide

Here are two examples --- with the expected result in () 

 

MAP for SI#303-22 (303-22) 
SI# 3-23 Code of Conduct Training for Z's R&D (3-23) 

Raj
16 - Nebula

(?:SI#\s*)?(\d{1,3}-\d{2})
@aehrenwo this works for your case

aehrenwo
11 - Bolide

Thanks! worked great. 

Labels
Top Solution Authors