PDA

View Full Version : Using Regular Expression in VBA



chrscote
07-03-2017, 06:39 AM
My company has a document that is created from an outside source using a template file. The template file contains a few VBA functions to format it the way we want. I am not very familiar with regular expressions, so I'm not sure what the following RegEx is looking for.
"\[" + DocName + "[0-9]{1,9}[s\],\]]"
where DocName is a variable of a string associated with certain documents (i.e. "SS-" => System Spec, "SSS-"=>Subsystem Spec, or "HS-"=>Hardware Spec.). There are also other strings associated with specific documents. I'm pretty sure that "[0-9]{1,9}" means 1-9 numeric characters (if I'm wrong, please correct me). However, my main question is with [s\]... What does this portion of the regex mean?

Any help would be very much appreciated,
Chris

gmayor
07-03-2017, 09:53 PM
See http://www.gmayor.com/replace_using_wildcards.htm
and the use of square brackets and the \ character.