-5

I don't know much about Regex and I have seen a code where this pattern "\s*\^++\s*" is used to compile but I still didn't get it, about what it actually checks for?

  • I'm specifically looking for this pattern & I've tried reading about regex for this. But, I still can't get through this one. If u have an explanation for this pattern then pls help. – Anish Gupta Nov 28 '19 at 05:10
  • If you want help, you need to improve this question a _lot_. You can start with stating _which_ of the myriad regex implementations you are using. Then you can provide some context as to how the code you've seen uses that pattern. And of course, you can explain **what research you've already done**. What have you tried so far to learn what the pattern means, and why did that attempt fail? – Peter Duniho Nov 28 '19 at 05:12
  • That extra ```+``` makes the regular expression invalid on most implementations BTW. It is a valid PCRE though. – accdias Nov 28 '19 at 05:13

1 Answers1

0

In the pattern :\s*\^++\s*

  • \s* is for 0 or more whitespace
  • \^++ is for matching 1 or more character ^

For example the following strings will match the above pattern:

<space>^^^<space>
^<space>
<space>^^^

For understanding regex pattern I have found the following link very useful: https://regex101.com/