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

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -