Hi i need to extract only the number and symbol from a string
example
Input : “ISP202032667-12.pdf”
Output : “202032667-12.pdf”
Thnks
Hi i need to extract only the number and symbol from a string
example
Input : “ISP202032667-12.pdf”
Output : “202032667-12.pdf”
Thnks
Hi @Ahmad_Rais
Please use the following RegEx pattern:
(?<=ISP)\d+-\d+\.pdf
Hope this helps,
Best Regards.
system.text.regularexpression.regex.match(input,“[\d-]+”).value
Hi @Ahmad_Rais
Use the regular expressions for the required output. Check the below regular expression.
System.Text.RegularExpressions.Regex.Matches(yourstringinput.ToString,“((?<=[A-Z]+)\d.*)”)
Hope it helps!!
Hi,
If you need to keep extension and remove alphabet in filename without extension, the following will work.
System.Text.RegularExpressions.Regex.Replace(System.IO.Path.GetFileNameWithoutExtension(yourString),"[A-Za-z]","")+System.IO.Path.GetExtension(yourString)
Regards,
Hi @Ahmad_Rais
Try this-
[^a-zA-Z]+
.Thanks!!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.