javascript - Regular express to match `command--o1--o2--o3` -
i have string command--o1--o2--o3
( command,o1,o2,o3 arbitrary words)
and want [o1, o2, o3]
though regular expression(not array operation or other ways. use regular expression).
is there idea accomplish !?
if you're using javascript, , assuming want strings after --
, may do
var things = str.split(/--/).slice(1)
if want 2 characters words following --
, may use
var things = str.match(/--\w\w/g).map(function(s){ return s.slice(2) })
Comments
Post a Comment