Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Input line=REVISION_LOCATION:../setup/projects/DEMO/space


The below code not works for me .It is not considering the ..

How can i do it?

What I have tried:

if ($input_line=/^REVISION_LOCATION:\s*(\S+)/) {
    $input_line = $1;

}
Posted
Updated 23-Mar-17 23:45pm
v2
Comments
Jochen Arndt 24-Mar-17 3:45am    
Where is the problem?
$1 will be "../setup/projects/DEMO/space" for your example.
example file 24-Mar-17 4:48am    
actually ../setup/projects/DEMO/space.Here .. reperesents previous directory.Will the above code will consider .. as previous directory
Jochen Arndt 24-Mar-17 5:16am    
It is just a string with a relative path. If you want to access that you had to know the base path. But that is not related to the regex.

 
Share this answer
 
Regex regex = new Regex(@"REVISION_LOCATION:\s*(\S+)/");
           Match match = regex.Match("REVISION_LOCATION:../setup/projects/DEMO/space");
           if (match.Success)
           {
               Console.WriteLine(match.Value);
           }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900