c# - Using a regular expression to find words with lower and upper case characters in parenthesis -


i'm creating program searches string finding words in parenthesis lower , upper case characters can't seem figure out regular expression use. example word - (lowerupper)

regular expression :

string upperlowerparens = "\\([a-z][a-z][a-z]+[a-z]+\\)"; 

try 1

\(([a-z]+[a-z]+)[a-za-z]*\)|\(([a-z]+[a-z]+[a-za-z]*)\) 
  • explanation

this divided 2 parts if 1 of them matched word between brackets matched

  1. \(([a-z]+[a-z]+)[a-za-z]*\) validates (lowerupper) capital letters appears first
  2. \(([a-z]+[a-z]+[a-za-z]*)\) validates (upperlower) lower case letters appears first

f want allow spaces after , before brackets can change regex \( *([a-z]+[a-z]+)[a-za-z]* *\)|\( *([a-z]+[a-z]+[a-za-z]*) *\)

check demo here demo


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -