can anyone send me regex pattern for the following text
2869-1-456789 My_sheet_34567_Doc
2345-1-456782 My_Job_45789-copy
here i want the text from second hyphen
output should be only 456789
456782
can anyone send me regex pattern for the following text
2869-1-456789 My_sheet_34567_Doc
2345-1-456782 My_Job_45789-copy
here i want the text from second hyphen
output should be only 456789
456782
HI,
How about the following expression?
System.Text.RegularExpressions.Regex.Match(yourString,"(?<=^\d+-\d+-)\d+").Value
Regards,
If that is a standard format, I will not even use regex to extract that output. String manipulation will do.
First use split to split the input using the space as the splitter:
e.g.
strOutput = strInputSring.Split(" "c)(0).toString
Then use substring to get final output
strOutput = strOutput.Substring(strOutput.Length - 6,6)
Hi @T_Y_Raju
Try this:
(?<=-)\d+(?= [A-Za-z])
Hi @T_Y_Raju
Try this:
System.Text.RegualarExpressions.Regex.Match(Input,"(?<=\d+\-\d+\-?)\d+").Value.Trim
Hope it helps!!
where should i write System.Text.RegualarExpressions.Regex.Match(Input,“(?<=\d+-\d+-?)\d+”).Value.Trim
in Assign statement
Hi @T_Y_Raju
Use it in Assign activity.
Save To: Output
Value to Save: System.Text.RegualarExpressions.Regex.Match(Input,"(?<=\d+\-\d+\-?)\d+").Value.Trim()
Output is of DataType System.String
Regards
Use assign activity
To:Str_Output
Value:System.Text.RegularExpressions.Regex.Match(Input,“(?<=-)\d{5,}”).Value
Hi @T_Y_Raju
Or you can try this way:
Input = "2869-1-456789 My_sheet_34567_Doc
2345-1-456782 My_Job_45789-copy"
→ Find matching Patterns:
Pattern: "(?<=\d+\-\d+\-?)\d+"
Output = String.Join(Environment.NewLine, Output.Cast(Of Match)().Select(Function(m) m.Value.Trim()))
Output variable will print all the matches.
Hope it helps!!
if the format is standard you can directly use split
requiredvalue = str.Trim.Split({"-"," "},StringSplitOptions.None)(2)
cheers