How do you make a regular expression that matches a word with one randomly inserted character?

Posted by Dfowj on Stack Overflow See other posts from Stack Overflow or by Dfowj
Published on 2010-06-02T21:14:47Z Indexed on 2010/06/02 21:34 UTC
Read the original article Hit count: 189

Filed under:
|
|

Hey all, i want to use a regular expression to match a word with one specified character randomly placed within it. I also want to keep that 'base' word's characters in their original order.

For example, with the 'base' word of test and the specified character of 'y', i want the regular expression to match all the following, and ONLY the following: ytest, tyest, teyst, tesyt, testy

Incase it matters, im working in javascript and using the dojo toolkit.

Thanks!

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about regex