javascript - Is there an easy way to specify a wildcard character in a regex for coffeescript? -



javascript - Is there an easy way to specify a wildcard character in a regex for coffeescript? -

i want able

if target.hostname == string.match(/attacker./)

and match hostname has string such "attacker1", "attacker2", etc.

i can't seem find equivalent in coffeescript. perhaps knows regex syntax?

update:

i have used illustration here: http://www.elijahmanor.com/regular-expressions-in-coffeescript-are-awesome/

to create regex:

attackerpattern = /// ^ # begin of line /attacker/ # word "attacker" ([0-9]+) # followed number \. # followed dot ([a-za-z]+) # followed 1 or more letters \. # followed dot ([/com/]) # followed com ///i # end of line , ignore case

because want grab said "attacker1.node.com" or "attacker2.node.com", etc.

i seem able grab pattern:

attackerpattern = /attacker/i

and maybe plenty (because won't care rest of hostname), kind of want more specific example, needs have .someword.com after "attacker1". suggestions?

javascript regex coffeescript

Comments

Popular posts from this blog

php - How to pass multiple values from url -

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

database - php search bar when I press submit with nothing in the search bar it shows all the data -