You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 5259 Reporter: gerd Status: acknowledged (set by @damiendoligez on 2011-04-29T09:22:49Z) Resolution: open Priority: normal Severity: feature Platform: all OS: all OS Version: all Version: 3.12.0 Category: otherlibs Monitored by:@ygrek
Bug description
The idea is to have a new function Str.eregexp that parses the "extended" syntax. The main difference so far looks tiny, but has a lot of impact on the readability of code. Essentially, ( ) | no longer need a backslash. The reference standard here are POSIX extended regular expressions. It also defines the {bound} construct.
The extended syntax is nowadays used in most other programming languages. It feels like stepping back when using ocaml.
When introducing this, it might also be a good idea to define/reserve a generic way for extending the syntax later, e.g. for additional assertions and non-capturing groups, as suggested by other bug reporters. Using more backslash sequences does not look very elegant. More readable seems to be:
Character classes like [[:name:]]
Group with modifiers: (?switches:regexp), e.g.
(?i:regexp) for a case-insensitive non-capturing group
The str library has many shortcomings (global state, clunky API, etc) and it is highly unlikely it will be developed further (in fact it will be split off the compiler distribution when it is feasible).
Original bug ID: 5259
Reporter: gerd
Status: acknowledged (set by @damiendoligez on 2011-04-29T09:22:49Z)
Resolution: open
Priority: normal
Severity: feature
Platform: all
OS: all
OS Version: all
Version: 3.12.0
Category: otherlibs
Monitored by: @ygrek
Bug description
The idea is to have a new function Str.eregexp that parses the "extended" syntax. The main difference so far looks tiny, but has a lot of impact on the readability of code. Essentially, ( ) | no longer need a backslash. The reference standard here are POSIX extended regular expressions. It also defines the {bound} construct.
The extended syntax is nowadays used in most other programming languages. It feels like stepping back when using ocaml.
When introducing this, it might also be a good idea to define/reserve a generic way for extending the syntax later, e.g. for additional assertions and non-capturing groups, as suggested by other bug reporters. Using more backslash sequences does not look very elegant. More readable seems to be:
(?i:regexp) for a case-insensitive non-capturing group
Additional information
One would also need Str.equote.
A good reference comparing regexp flavors by syntax: http://www.regular-expressions.info/refflavors.html
The text was updated successfully, but these errors were encountered: