eg:
isValidCppIdentifier("_foo") // returns true isValidCppIdentifier("9bar") // returns false isValidCppIdentifier("var'") // returns false
I wrote some quick code, but it fails: my regular expression "[a-zA-Z_$][a-zA-Z0-9_$]*" and I just do regex.IsMatch(inputString).
"[a-zA-Z_$][a-zA-Z0-9_$]*"
regex.IsMatch(inputString)
Thank..
It should work with some added bindings:
"^[a-zA-Z_][a-zA-Z0-9_]*$"
If you really need to support ridiculous identifiers using Unicode, feel free to read one of the different versions of the standard and add all ranges to your regular expression (for example, pages 713 and 714 http://www-d0.fnal.gov/~dladams/cxx_standard .pdf )
Matti ++-, ++. , , L"wchar_t string", L . Unicode.
L"wchar_t string"
L
Clang, Apple, , . , clang_createTranslationUnitFromSourceFile clang_tokenize.
clang_createTranslationUnitFromSourceFile
clang_tokenize
, \Uxxxx - . - . LLVM , ... .
\Uxxxx
, GCC , , , cpp_lex_direct.
Source: https://habr.com/ru/post/1762006/More articles:preg_replace multiple instances in 1 line? - phpHow to get id value for checkbox? - jqueryFacebook API, Canvas app in iFrame, Javascript API broken in IE8? - apiSingle-user OpenID server with Rails - ruby-on-railsFacebook Connect Integration: Does Flash Require? - flashclsql connect oracle database - oracleHow does a dependency introduce a class / type? - c #Chrome / Javascript extension - determining the user's language in the Chrome browser - javascriptJavascript source JSON help - jsonIs the WER web service API (winqual) documented anywhere - windows-error-reportingAll Articles