Both languages claim to use Perl style regular expressions. If I have one language test a regular expression for validity, will it work in the other? Where do the regular expression syntaxes differ?
The use case here is a C# (.NET) UI talking to an eventual Java back end implementation that will use the regex to match data.
Note that I only need to worry about matching, not about extracting portions of the matched data.
C is a middle-level language as it binds the bridges between machine-level and high-level languages. Java is a high-level language as the translation of Java code takes place into machine language, using a compiler or interpreter. C is only compiled and not interpreted. Java is both compiled and interpreted.
As a result, the development of various languages has been influenced by C language. These languages are C++ (also known as C with classes), C#, Python, Java, JavaScript, Perl, PHP, Verilog, D, Limbo and C shell of Unix etc. Every language uses C language in variable capacity.
A programming language created initially for Sun Microsystems set-top box project. The language later evolved to become Java. A high-level programming language which targets low-level hardware, most commonly used in the programming of FPGAs. It is a rich subset of C.
C# and Java are similar languages that are typed statically, strongly, and manifestly. Both are object-oriented, and designed with semi-interpretation or runtime just-in-time compilation, and both are curly brace languages, like C and C++.
There are quite (a lot of) differences.
[abc-[cde]]
[abc&&[^cde]]
)[abc&&[cde]]
[abc-[^cde]]
)\p{Alpha}
POSIX character class (?x)
mode COMMENTS
/IgnorePatternWhitespace
, space (U+0020) in character class is significant. \p{L}
form only\pL
, \p{L}
, \p{IsL}
\p{general_category=L}
, \p{gc=L}
\p{Lu}
form only\p{Lu}
, \p{IsLu}
\p{general_category=Lu}
, \p{gc=Lu}
\p{IsBasicLatin}
only. (Supported Named Blocks)\p{InBasicLatin}
\p{block=BasicLatin}
, \p{blk=BasicLatin}
BasicLatin
can be written as Basic_Latin
or Basic Latin
) ?+
, *+
, ++
and {m,n}+
(possessive quantifiers) \Q...\E
escapes a string of metacharacters \Q...\E
escapes a string of character class metacharacters (in character sets) (?(?=regex)then|else)
, (?(regex)then|else)
, (?(1)then|else)
or (?(group)then|else)
(?<name>regex)
or (?'name'regex)
\k<name>
or \k'name'
(?<name>regex)
\k<name>
(?<name1-name2>regex)
or (?'name1-name2'subexpression)
(?<=text)
(positive lookbehind) (?<!text)
(negative lookbehind) ExplicitCapture
option (?n)
(?#comment)
inline comments Check out: http://www.regular-expressions.info/refflavors.html Plenty of regex info on that site, and there's a nice chart that details the differences between java & .net.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With