Regular Expressions: Difference between revisions

From David's Wiki
Created page with "Regular expressions are used for matching text. ==Useful Regular Expressions== ===Floating Point Number=== [https://www.regular-expressions.info/floatingpoint.html Referenc..."
 
No edit summary
Line 4: Line 4:


==Useful Regular Expressions==
==Useful Regular Expressions==
Mostly copied from [https://rgxdb.com/ Regex DB].
===Floating Point Number===
===Floating Point Number===
Without matching scientific notation (e.g. 1.5e-6).
[https://www.regular-expressions.info/floatingpoint.html Reference]
[https://www.regular-expressions.info/floatingpoint.html Reference]
<syntaxhighlight lang="ragel">
<syntaxhighlight lang="ragel">
[-+]?[0-9]*\.?[0-9]+
[-+]?[0-9]*\.?[0-9]+
</syntaxhighlight>
With matching scientific notation (e.g. 1.5e-6).
[https://rgxdb.com/r/1RSPF8MG Reference]
<syntaxhighlight lang+"ragel">
([-+]?\d*\.?\d+)(?:[eE]([-+]?\d+))?
</syntaxhighlight>
</syntaxhighlight>

Revision as of 12:07, 23 September 2019

Regular expressions are used for matching text.


Useful Regular Expressions

Mostly copied from Regex DB.

Floating Point Number

Without matching scientific notation (e.g. 1.5e-6). Reference

[-+]?[0-9]*\.?[0-9]+

With matching scientific notation (e.g. 1.5e-6). Reference

([-+]?\d*\.?\d+)(?:[eE]([-+]?\d+))?