You are viewing limited content. For full access, please sign in.

Question

Question

regular expression to remove the letters o, i, q

asked on August 31, 2022

Hello all,

I'm working on a project where someone enters the VIN of their automobile (17 characters, letters/numbers).  We frequently have erroneous entries with the letters o (O),i(I),q(Q), which aren't used in the VIN.  Can someone show me a regular expression for validation that either excludes these entries or gives invalid input if they are entered?  I don't have access to workflow so it would have to be in the forms validation area.  I've already put text below the field that says don't use those letters, but that didn't help.

 

Any help would be appreciated!

Donnie

0 0

Answer

SELECTED ANSWER
replied on August 31, 2022 Show version history

Hi Donnie, I just tested both regex's in Forms with your test values and it works as expected. Did you use the All Caps version or the Upper lower case regex

You need to use this one for upper/lower case

1 0

Replies

replied on August 31, 2022

Try this [(A-H|J-N|P|R-Z|0-9)]{17}

If you allow both upper and lower characters, try [(a-hA-H|j-nJ-N|pP|r-zR-Z|0-9)]{17}

0 0
replied on August 31, 2022

Steve,

Thanks for the assistance.  so when I enter this:

it's obviously invalid because of the "i" at the end.  so I change it to this:

but I still get the invalid input.  If I refresh the form (which I don't want the user to do as this is halfway down the form) any input gives the "Invalid input" error.

I copied and put your expression in.  the limit of 17 works.

0 0
SELECTED ANSWER
replied on August 31, 2022 Show version history

Hi Donnie, I just tested both regex's in Forms with your test values and it works as expected. Did you use the All Caps version or the Upper lower case regex

You need to use this one for upper/lower case

1 0
replied on August 31, 2022

Did you tab off of the field or select another field after you made the change?

replied on September 1, 2022

Steve,

I'm sorry, I didn't realize that I should use that one.  It works! Thanks for your assistance!

Donnie

0 0
replied on September 1, 2022

Just an FYI, I realized after the fact I didn't need to put OR's (|) in the regex, you can just use the regex as below and it provides the same results

[(a-hj-npr-zA-HJ-NPR-Z0-9)]{17}

0 0
replied on September 1, 2022

Thanks, I will keep these where I store Java/CSS/Regexs so I look like I know what I'm doing.

Appreciate your help!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.