rfc:native_regular_expressions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
rfc:native_regular_expressions [2014/08/14 01:35] – Jotting my thoughts down. bishoprfc:native_regular_expressions [2014/08/15 13:34] bishop
Line 6: Line 6:
   * First Published at: http://wiki.php.net/rfc/native_regular_expressions   * First Published at: http://wiki.php.net/rfc/native_regular_expressions
  
 +FIXME FIXME FIXME
 Jotting my ideas down here.  Move along. Maybe called "first_class_citizens_regex" or something. Jotting my ideas down here.  Move along. Maybe called "first_class_citizens_regex" or something.
  
 New built-in "re" BNF is roughly: New built-in "re" BNF is roughly:
  
 +<code>
 syntax := re <fence-post> <regex-chars> <fence-post> <regex-modifiers> <semic> syntax := re <fence-post> <regex-chars> <fence-post> <regex-modifiers> <semic>
 fence-post := <any character> fence-post := <any character>
Line 15: Line 17:
 regex-modifiers := whatever is valid for modifiers regex-modifiers := whatever is valid for modifiers
 semic := ';' semic := ';'
 +</code>
  
 Example: Example:
 +<code>
 $regex = re /^\w+$/i $regex = re /^\w+$/i
 preg_match($regex, 'whatever'); preg_match($regex, 'whatever');
 ereg_match($regex, 'whatever'); // wouldn't work... maybe need $regex->test() ereg_match($regex, 'whatever'); // wouldn't work... maybe need $regex->test()
 +</code>
  
 +====== Motivation ======
 +  * Regex are integral to modern info processing
 +  * Quoting them inside strings is hard: you have the quote character to deal with, plus the fence post
 +  * Other languages have re built in
  
-Motivation +====== Goals ====== 
-Regex are integral to modern info processing +  Reduce effort of code authors to quote regex properly 
-* Quoting them inside strings is hard: you have the quote character to deal with, plus the fence post +  Compile time verification of regex (benefit?)
-Other languages have re built in+
  
-Goals: +====== Non-goals ====== 
-Reduce effort of code authors to quote regex properly +  Adding a new regex class, with methods like $re->test('whatever')
-* Compile time verification of regex (benefit?)+
  
-Non-goals+====== Similar implementations ====== 
-Adding a new regex class, with methods like $re->test('whatever')+  * Javascripthttp://mrrena.blogspot.com/2012/07/regular-expressions-in-javascript.html 
 +  Python: https://docs.python.org/3/howto/regex.html 
 +  * Comparison: http://hyperpolyglot.org/scripting
  
-Similar implementations: +====== Discussions ====== 
-Javascript: http://mrrena.blogspot.com/2012/07/regular-expressions-in-javascript.html +  https://news.ycombinator.com/item?id=7889923 
-Python: https://docs.python.org/3/howto/regex.html +  http://stackoverflow.com/questions/25310999/what-is-the-maximum-length-of-a-regular-expression
-* Comparison: http://hyperpolyglot.org/scripting+
  
-Discussions: 
-https://news.ycombinator.com/item?id=7889923 
  
 +----
  
 This is a suggested template for PHP Request for Comments (RFCs). Change this template to suit your RFC.  Not all RFCs need to be tightly specified.  Not all RFCs need all the sections below. This is a suggested template for PHP Request for Comments (RFCs). Change this template to suit your RFC.  Not all RFCs need to be tightly specified.  Not all RFCs need all the sections below.
rfc/native_regular_expressions.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1