Is the syntax for standardizing a standard expression? That is, if I write a regular expression in C ++, it will work in Python or Javascript without any changes.
No, there are several dialects of regular expressions.
They usually have many common elements.
Some popular ones are listed and compared here .
Simple regular expressions, mostly yes. However, there are differences across the entire spectrum of programming languages.
, , :
JavaScript ( \ \s \\s), /. /. JS RegExp, .
\
\s
\\s
/
RegExp
/^\w+$/i new RegExp("^\\w+$", "i") .
/^\w+$/i
new RegExp("^\\w+$", "i")
PHP ( - , ). .
"|[0-9]+|" #[0-9]+#
"|[0-9]+|"
#[0-9]+#
Python and C # support raw strings (not limited to regular expressions, but very useful for writing regular expressions), which allow you to write unescaped backslashes in your regular expression.
"\\d+\\s+\\w+"can be written in both r'\d+\s+\w+'Python and @'\d+\s+\w+'C #
"\\d+\\s+\\w+"
r'\d+\s+\w+'
@'\d+\s+\w+'
Constraints such as \<, \Aetc., are not supported globally.
\<
\A
DOTALL
Source: https://habr.com/ru/post/1736310/More articles:How do you verify the correctness of data in a data file? - databaseC # How to distinguish data type? - c #https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1736307/how-to-use-resque-scheduler-and-resque-status-together&usg=ALkJrhiOZzv0paBpUUpSzhnmEaA8UFZF5wProblem with web GUI design - javascriptlinux batch переименовывать каталоги и полоса # символа от имени - command-lineWhat is the difference between a reference to object.id vs object [: id] when returning a model dataset? - ruby | fooobar.comIs there a utility way to split a list by a given string? - javaMulti-click event handling in jQuery where order is important - javascriptHow to use lazy_gettext with Pylons and setup.py - pythonNHibernate cells - they are turned into SQL - sqlAll Articles