Start a new topic

Regular expression to match text that begins with a certain value

Is it possible to create a regular expression in a dictionary to translate anything starting with a certain value to translate to a specific text?

 

For example, I would like anything that starts with "Test Value: " to translate to "Example". This would mean "Test Value: A", "Test Value: B", and "Test Value: C" would all translate to "Example".

 

Thanks!


Hi Casey,

Here you go.

 

image

 

Thanks,

John

This is an old post, but I'm wondering why this example doesn't work for a zip code. For example, I want 80132 OR its zip plus-4 (80132-5046) to be replaced with Yes. When I input ^80132.* as my match value, it does not work, is that because of the dash?

Jessica, try the below 


(^\d{5}$)|(^\d{9}$)|(^\d{5}-\d{4}$)


image


Thanks, Dennis dennis@ladnierfamily.com

Hi Dennis, thanks for the suggestion. Unfortunately doesn't seem to work when I try to test:

image


Holler if you think of anything else, thank you!

Ah Dennis, forgive me. I just realized I needed this entry to be higher on the list of match values, so that partially solved it! It now works for any zip code plus 4, but let me better explain my dictionary. I want a few zip codes to trigger a Yes value, and any other zip codes to trigger a No value. As my dictionary stands, anything starting 808 or 809 works fine (input of either 5 or 9 digits).

image


However, I'm having trouble getting the expression to work for the rest of those zip codes, which all start with a certain 5 digits. 

image



Login or Signup to post a comment