1

In this post. Parsing all possible types of varying architectural dimension input Can someone explain why the accepted answer fails regex validation when I try to test it on this site. https://regex101.com/ It is saying that the subpattern feet and inches are defined multiple times. which they are.

Is this just a difference between C# and JavaScript?

Here is the regex I was trying in regex101. After I removed the double back slashes.

^\s*(?<minus>-)?\s*(((?<feet>\d+)(?<inch>\d{2})(?<sixt>\d{2}))|((?<feet>[\d.]+)')?[\s-]*((?<inch>\d+)?[\s-]*((?<numer>\d+)/(?<denom>\d+))?\")?)\s*$
Community
  • 1
  • 1
pricejt
  • 107
  • 12
  • post the regex101 link you have been tested. And note that you should replace double backslashes with single backslash in regex101. – Avinash Raj Sep 15 '15 at 12:54
  • 2
    If you mean `((?\\d+)(?\\d{2})(?\\d{2}))|((?[\\d.]+)')?[\\s-]*((?\\d+)?[\\s-]*((?\\d+)/(?\\d+))?\")?`, it contains named captures that are not supported by the JS regex engine. – Wiktor Stribiżew Sep 15 '15 at 12:55
  • I guess this is a case for [Learning Regular Expressions](http://stackoverflow.com/a/2759417/3832970). – Wiktor Stribiżew Sep 15 '15 at 12:57

0 Answers0