0

I'm trying with grep to find Twig variables that do not respect naming conventions, excluding object properties. So I would like to match camelCase words, that doesn't start by "."

does.notMatch
doesMatch
some words doesMatch

I've tried this :

^\w+[A-Z]\w+

But it matches only with full lines.

Tristan
  • 35
  • 6
  • Does this answer your question? [regex word boundary excluding the hyphen](https://stackoverflow.com/questions/10196462/regex-word-boundary-excluding-the-hyphen) – Justinas Oct 14 '22 at 08:58

1 Answers1

1

I don't know what you want.

But it will work /(\s|^)(?<!(\.))([a-z]+[A-Z][a-z]+)/g according to your description enter image description here

Domo: https://regex101.com/r/3tGe4N/1

Art Bindu
  • 769
  • 4
  • 14
  • The lookbehind `(?<!(\.))` seems redundant here. If there is `(\s|^)` preceding `[a-z]`, it is already impossible that there occurs a period. – bobble bubble Oct 14 '22 at 11:03
  • I am validating the camelcase word which starts with Space/checked is This new Line `(\s|^)` and then checking is this does not start with full-stop using lockbehind `(?<!(\.))`. – Art Bindu Oct 15 '22 at 04:07