Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do ++ and *+ mean?

Tags:

I am porting some libraries from PHP to JavaScript and I came across this regular expression, some parts of it are unclear to me.

#(?: *+(?<= |^)\.((?:\([^)\n]++\)|\[[^\]\n]++\]|\{[^}\n]++\}|<>|>|=|<){1,4}?))#

Unclear parts are

  1. *+
  2. ++

I know, that this expression should accept strings like

.(title)[class]{style}<>
.[class]{style}<>
.[class](title){style}
// and so one - no metter of order \(.+\), \[.+\] and \{.+\} parts 
// and optional <>, >, = or < at the end

This expression is used with PCRE_UNGREEDY modifier.

like image 266
Jakub Truneček Avatar asked Jun 12 '13 11:06

Jakub Truneček


People also ask

What does :) mean in chat?

The :-) notation is known as a smiley, and means that the statement it follows was intended as humor. When you tilt your head to the side, you see that : is the eyes, - the optional nose, and ) is the mouth.

What does this mean in a text :/?

What Does :/ Mean? :/ is an emoticon used to indicate indecision, skepticism, exasperation, and annoyance. The emoticon :/ is one of the most difficult to define. It can indicate a wide range of emotions, including (but not limited to) indecision, skepticism, exasperation, and annoyance.

What does D mean in chat?

Summary of Key Points "Very Happy" is the most common definition for :D. on Snapchat, WhatsApp, Facebook, Twitter, Instagram, and TikTok. :D.

What does the & symbol do in C?

The ampersand symbol & is used in C++ as a reference declarator in addition to being the address operator.


1 Answers

++

From What is double plus in regular expressions?

That's a Possessive Quantifier.

It basically means that if the regex engine fails matching later, it will not go back and try to undo the matches it made here. In most cases, it allows the engine to fail much faster, and can give you some control where you need it - which is very rare for most uses.

*+

*+ is the possessive quantifier for the * quantifier.

like image 83
Wouter J Avatar answered Sep 18 '22 13:09

Wouter J