About the $yy_global_pattern found in smarty

/^(\{\})|^(\{\*([\S\s]*?)\*\})|^(<\?(?:php\w+|=|[a-zA-Z]+)?)|^([     ]*[
]+[  ]*)|^(\{strip\})|^(\{\/strip\})|^(\{literal\})|^(\{\s{1,}\/)|^(\{\s{1,})|^(\{\/)|^(\{)|^(([\S\s]*?)(?=([    ]*[
]+[  ]*|\{|<\?)))|^([\S\s]+)/

Anyone know what's ^(<\?(?:php\w+|=|[a-zA-Z]+)?) for in the above pattern?


It matches the beginning of XML processing directives. It seems targeted at php, as it explicitly matches <?php and <?=.

However, it also matches the XML prologue <?xml (or any other sequence, such as <?xcvsdfadf) too, so the actual purpose is hard to tell.

  • ^: anchor at the beginning of the line.
  • (..): grouping, to be referenced later (probably from the code for extraction).
  • \?: literal ?.
  • (?:..|..): alternatives (without extraction), matches either of the |-separated sub-patterns.
    • ?: following the alternatives means it can be left out completely as well. (zero or one)
  • php\w+: literal php followed by one or more word characters.
  • =: literal =
  • [a-zA-Z]+: one or more of upper or lower case characters (A-Z only)


Need Your Help

Checking Internet Connection without URL test connection using java

java connection jna

How can I check whether my computer is connected to the Internet. I don't want to use URL check method. Is it possible to call an operating system's function using java? For example, in JNA library...

How can I get the source code from a page using javascript

javascript d3.js

I'm trying to get the source code of that page (using js and d3js library)

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.