PowerShell Regex This topic contains 2 replies, has 2 voices, and was last updated by Amar Helloween 4 months, 2 weeks ago. Author Posts September 6, 2016 at 1:13 pm #53507 Amar HelloweenParticipant Hi All, Need a help to extract the exact integer number from a set of string. In the below example, I want to extract only 7614. Suggest a regex for the same. INFO: TB_SEC_FOLDER, 7614 folders I tried, $a = 'INFO: TB_SEC_FOLDER, 7614 folders' $a -replace '\D+(\d+)','$1' but it will give me output as 7614 folders, it will work if its only $a = 'INFO: TB_SEC_FOLDER, 7614' September 6, 2016 at 1:39 pm #53520 Craig DuffParticipant $a -replace '^\D+(\d+).*$','$1' The problem is that it replaces only the regex match, so you have to have the pattern match the whole string. September 6, 2016 at 1:51 pm #53524 Amar HelloweenParticipant Thanks Craig Author Posts You must be logged in to reply to this topic.