Why can't Regular Expressions use keywords instead of characters?

后端 未结 14 3180
甜味超标
甜味超标 2021-02-20 06:46

Okay, I barely understand RegEx basics, but why couldn\'t they design it to use keywords (like SQL) instead of some cryptic wildcard characters and symbols?

Is it for pe

14条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-20 07:21

    I don't think keywords would give any benefit. Regular expressions as such are complex but also very powerful.

    What I think is more confusing is that every supporting library invents its own syntax instead of using (or extending) the classic Perl regex (e.g. \1, $1, {1}, ... for replacements and many more examples).

提交回复
热议问题