Start a new topic

REgular Expression for when a string of numbers doe snot equal a specific string of numbers

 Okay, what am I doing wrong?


image



I just want to replace with 69997 if the incoming string of numbers is not 190160, and replace with 00001-593-0000375159 if it is190160. But instead it is giving me 69997 with the original string added to the end when I input a string that is not 190160.

Thanks,
Jana


Hi Jana,


It looks like you need to adjust your value to match on slightly.  It needs to be ^(?!190160).*$


Thanks,


John

Thank you for your input. I tried that already and that doesn't work. The dictionary is supposed to give me 00001-593-0000375159 when I enter 190160, but it gives me 69997 when I enter it using the formula you supplied. My other formula was the closest to working of all I tried. WIth the formula you gave I get 69997 no matter what I enter, including 190160.

 

image


Here is the other part of the dictionary, FYI. With your reg expression added in, it completely ignores this. With my formula, this part works, even though the second part is only semi-working.


image



Now that you've shared both lines I see the issue.    Regular expression values cascade.  So when you enter 190160 in the test it is converting it to 00001-593-0000375159.  Then it gets to the second row and its not analyzing 190160 anymore because it has been converted to 00001-593-0000375159.  Since 00001-593-0000375159 does not equal 190160 it converts it to 69997.  To correct this your second line value to match on needs to be your first line's replacement value so your second line value to match on needs to be ^(?!00001-593-0000375159).*$



Thank you, that totally makes sense and it works. :)

Login or Signup to post a comment