PDA

View Full Version : Wildcard Expressions To Regular Expressions Converter



bardonw
04-26-2011, 04:48 PM
There are many people that know how to work with wildcard characters to search for files, but not as many know how to write regular expressions. For this reason, I created a wildcard expression to regular expression converter. You can find it here: http://jpaq.org/examples/10. For instance, the following wildcard expression will match any word in Microsoft Word:

<*>

The equivalent regular expression of this, as was generated by the converter, is as follows:

/\b(?=\w).*?(?:\b$|(?=\W)\b)/g

To use this converter, simply enter the desired wildcard expression and then click outside of the Wildcard Expression textbox. In addition, you can use this page to test out your expression by clicking the "Execute the Code" button at the end of the example. Let me know if you have any questions.