Preface: For "railroad diagrams", excerpted from the Network: http: // 202.207.0.245: 9001/jisuanjifazhanshi/Tuling/19.htm
We have seen that BNF in many languages is actually ebnf, but this E word is often ignored. When combined with BNF, there are also images that often look like railway maps, called syntax charts or syntax digrams, or railroad digrams ), this is also designed and invented by Wurth. The descriptive ability of this graphic marking method is equivalent to BNF, but of course it is easier to read and understand, and more intuitive.
P.s: Unfortunately, the source address graph is incomplete, otherwise ......
Regular expressions may be complicated (slightly less terse), but the correctness will be improved (slightly easier to use correctly ).
Javascript Regular Expressions Do not support blank spaces, so annotations are not supported. The reason for good parts is actually a security reason:
This is a participant concern when the are used in security applications for scanning and validation.
But on the one hand, the book puts forward the following:
If you cannot read and understand a regular expression, how can you have confidence that it will work correctly for all input?
Finally, some helplessness was revealed:
Yet, despite their obvious drawbacks, regular expresssions are widely used.
What is sloppy regluar experssions? Is the regular expression corresponding to rigorous regular expresssions. Although easy to write, it is the source of many security problems !?
Sloppy regular expressions are a popluar source of security exploits.
D.C points out that the Regexp library of JS has the least compatibility issues, because the core of this tool is very complex and generally won't be changed much. Note that writing regular expressions in literal mode is actually sharing an instance. For example:
Function makematcher () {<br/> return/A/GI; <br/>}< br/> var x = makematcher (); <br/> var y = makematcher (); <br/> // beware: X and Y are the same object! <Br/> X. lastindex = 10; <br/> alert (Y. lastindex); // 10To put it bluntly, the design is the flyweight mode in the design mode. Looking back at a previous bug, I don't know. Now I have reached this point, and I finally got a little eye on it ...... Haha