Why does Visual Studio use such a strange regex syntax

前端 未结 4 1515
长发绾君心
长发绾君心 2020-12-05 17:35

Is there any reason why Visual Studio uses such a strange syntax (for instance in the search/replace dialog)?

Instead of writing \\s*(\\w+) = new Process\\(\\)

4条回答
  •  萌比男神i
    2020-12-05 18:19

    Well, they tried to make it "easier" to use, it seems, for a C++ coder.

    Consider they provided new non-standard expressions, like

    C/C++ Identifier
    :i
    Matches the expression ([a-zA-Z_$][a-zA-Z0-9_$]*)
    
    Quoted string
    :q
    Matches the expression (("[^"]*")|('[^']*')).
    

    I think the reason it has completely different syntax is so the regex user clearly sees its non-standard and not the same as normal regex.

    Which is good. All in all its a good regex engine and easy to use.

提交回复
热议问题