Regex pattern for knowledge

New Text Document.txt (211 Bytes)

Hi @badal_patel

Try to use the below Expression:
System.Text.RegularExpression.Regex.Match("Input String","[a-zA-Z0-9 .\n()]+").Tostring

Regex Link:

Regards
Gokul

you take wrong input-

INPUT_

Ad-hor duties as assigned.
Basic IT knowledge in certificate in Information Technology.
Require to travel island wide.
Knowledge and experience in administering and supporting Microsoft Windows 10 (Essential)

You need to extract only the above this?

i want to extract

“knowledge in certificate in Information Technology.” and

" Knowledge and experience in administering and supporting Microsoft Windows 10 (Essential)"

Hi @badal_patel

Try the below Regex Expression

System.Text.RegularExpressions.Regex.Matches(Text1,"[kK].*")(1).ToString

System.Text.RegularExpressions.Regex.Matches(Text1,"[kK].*")(0).ToString

Look here:

Regards
Gokul


done with RegexOption i - Case Insensitive

Regex.Matches(YourString,YourPattern,RegexOptions.IgnoreCase)

New Text Document.txt (945 Bytes)

I want only data like " Knowledge or (some time knowledge) + "data after knowledge or (some time knowledge) "

please check this text file as an input

New Text Document.txt (1009 Bytes)

Please send full regex code

like System.Text.RegularExpressions.Regex.Match().To string

for multiple Knowlege and knowledge

Knowledge.*
and use matches
System.Text.RegularExpressions.Regex.Matches(… instead of Regex.Match(…

Match is retrieving the first match
Matches is retrieving all matches

1 Like

@badal_patel

System.Text.RegularExpressions.Regex.Match(String variable,"Knowledge.*").toString

@badal_patel Hope this REGEX will help you

Assign str_yourvariable = System.Text.RegularExpressions.Regex.Match(str_yourvariable ,"(Knowledge.)|(some time knowledge.)|(data after knowledge.*)").toString

can you please write full code

YourString, YourPattern are variables or hardcoded string

what if multiple Knowlege and knowledge are available

grafik

if multiple matches are found we can loop over it within a for each
OR
we are using last statement to get it returned as a string array

ensure following:
grafik

You can try this


System.Text.RegularExpressions.Regex.Match(String variable,"Knowledge.*|knowledge.*").toString

Regards
Sudharsan

1 Like

grafik

compare your implementation with the screenshot. Kindly note we are using 3 arguments within the method

so have a carefully check where all we have used a comma