regex - Issue with matching -
the following code below trying match format
[a=>]b[->c][d:e]
where a=>
, ->
c, d:e
optional.
($reg =~ /^ (?:([\w\/]+)=>)? # (optional) (\w+) # (required) (?:->(\w+))? # (optional) (\[\d+\]|\[\d+:\d+\])? # (optional) .$/x) or croak ("-e invalid register format );
when give input sample=>status
$reg value
, last s
of status
getting truncated. why?
the regex symbol .
before $
line-end symbol captures "one thing" in case, seems last letter s
this means regex right, "one thing" needed satisfied regex, regex matcher rewound required (\w+)
pattern 1 character give .
demanded character.
Comments
Post a Comment