Writing Regex that selects a VBScript Class and it's Name -


i writing regex selects vbscript class , it's name. @ moment here how look.

regex:

class\s*[a-za-z0-9_]* 

enter image description here

live code demo: http://regexr.com/3bco8

it fine, want modification selects "class person" , not select word class @ end of text.

both * quantifiers should replaced + (one or more of). using .multiline flag, anchoring @ start, , capturing class name may idea. whether want allow leading whitespace before class you:

option explicit  dim s : s = join(array( _     "' class forgetit" _   , "whatever" _   , " class findit" _   , "whatever" _   , "end class ' findit" _   , "s = ""class notme""" _   , "class metoo" _   , "end class" _ ), vbcrlf) dim r : set r = new regexp r.global = true r.ignorecase = true r.multiline = true r.pattern = "^\s*class\s+(\w+)+" dim m each m in r.execute(s)     wscript.echo m.submatches(0) next 

output:

cscript 31398009.vbs findit metoo 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -