Re: Regular Expressions in VBA
Well if your pattern is "5-hepten-2-one" it will evaluate true. So that's an easy one, it gets more advanced if you want it be at a specific location.
"5-hepten-2-one$" Will also eval true, the pattern states that it has to be the end of the string.
"([\w|-]*)5-hepten-2-one$" Will eval true on "6-methyl-5-hepten-2-one", but also set "6-methyl-" as first match in case you want to extract it.
"^([\w|-]*)5-hepten-2-one$" Will do the same as the line above, but it requires that there is no space or similar at the start of the text.
You can go here for more syntax http://www.aivosto.com/regexpr/help/syntax.html