Regexp, Allow Quantifiers on zero-length tests?

Description

Allow quantifiers on zero-length tests?

This is a Java compatibility question.
Java allows things like "`^`" or "\b" to appear in patterns.
It doesn't make any sense to repeat a test for being on a boundary position; any appearances of these constructs in patterns probably are an error or a misunderstanding by the author of the pattern.

ICU started to match Java, with quantifiers allowed on '`^`' and '$'. But there are many more, including look-ahead and look-behind.

ICU should be consistent with itself, and either allow these everywhere, or disallow them everywhere. Disallow seems best -

  • They don't do anything useful, and are likely user errors.

  • Allowing would require care, to avoid any possibility of sending the match engine
    into a loop on the zero length (no progress) match.

Historically, ICU dis-allowed these.

Activity

Show:
TracBot
June 30, 2018, 11:30 PM
Trac Comment 2 by —2012-11-29T02:45:13.148Z

Related, see http://code.google.com/p/android/issues/detail?id=28399
which is an Android bug reporting this problem with the pattern "(?=a)?"

Assignee

Andy Heninger

Reporter

Andy Heninger

Components

Labels

None

Reviewer

None

Priority

minor

Time Needed

Days

Fix versions

None
Configure