Skip to main content
Solved

How to find string that start with one letter then numbers

  • May 15, 2023
  • 1 reply
  • 975 views

spiderman
Contributor
Forum|alt.badge.img+7

Hello ,

i would like to use Regex to find three cases :

1.the string that starts with one letter then numbers as example a73939 or s939

2.and also to find string like S2820_hjd

(one letter then few numbers then underscore then numbers or letters )

3.and any string that start with one letter then underscore as O_Sjdld

i tried using string searcher transformer but I am not sure which regex should I type ?

fme 2021

thanks for help

 

Best answer by ebygomm

So a string starting with a letter followed by one or more numbers

^[a-zA-Z][0-9].*

^ start of line

[a-zA-Z] matches a single character

[0-9] matches a single number

.* matches any character an unlimited number of times

 

A string that starts with one letter then an underscore

^[a-zA-Z]_.*

^ start of line

[a-zA-Z] matches a single character

_ matches an underscore

.* matches any character an unlimited number of times

 

You can put them together separated by a pipe in the StringSearcher so anything that matches one or the other will exit the Matched port

e.g.

^[a-zA-Z][0-9]{2}.*|^[a-zA-Z]_.*

 

 

 

View original
Did this help you find an answer to your question?

1 reply

ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • Best Answer
  • May 15, 2023

So a string starting with a letter followed by one or more numbers

^[a-zA-Z][0-9].*

^ start of line

[a-zA-Z] matches a single character

[0-9] matches a single number

.* matches any character an unlimited number of times

 

A string that starts with one letter then an underscore

^[a-zA-Z]_.*

^ start of line

[a-zA-Z] matches a single character

_ matches an underscore

.* matches any character an unlimited number of times

 

You can put them together separated by a pipe in the StringSearcher so anything that matches one or the other will exit the Matched port

e.g.

^[a-zA-Z][0-9]{2}.*|^[a-zA-Z]_.*

 

 

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings