Regex pattern for knowledge

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)
    output-
    I want to scrape “knowledge in certificate in Information Technology.
    Knowledge and experience in administering and supporting Microsoft Windows 10 (Essential)”
    can you send me regex pattern for this
  1. List item

Hi @badal_patel

Do you need the regex for the above statement?
If Yes, can you send it in the Text file format?

Yes.

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