Home > Software design >  Regex matching camelcase words not starting by "."
Regex matching camelcase words not starting by "."

Time:10-14

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.

CodePudding user response:

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

  • Related