My  httpd.conf  file has this string: 
  Listen 12.0.0.0:80    and I want to replace the IP address and semicolon with  = . 
My batch command is:
  Type C: \ h \ httpd.conf | Repl "listen (\ d {1,3} \. \ D {1,3} \. \ D {1, 3} \. \ D {1,3}):" listen = "& gt; C: \ H \ h.conf    listen to  = 80  
 but if  listen  and many between IP address How to write regular expression? 
Example:
  listen to 12.0.0.0:80   I hope I understand it properly.
You try to change an IP address and port with something Are doing and Whitespace's as the beginning and closing markers
I'm not sure what exactly you want Sim Please explain some basic rules:
  \ d {1,3}    is similar to saying: 1-3 digits. 
 Example: 123 or 78 9 or 99 
. Your Regular Anything in the expression will match! You should save it.
 It: \ d {1,3}. \ D {1,3}. \ D {1,3}. \ D {1, 3} 1-3 will match the digits, after that, anything, after 1-3 points ... 
 example: 
 99 9 888 B777C666 but surely the IP Those addresses: 127.0.0.1 
( and ) do nothing in your example. You can probably remove them.
If you want to match a space letter, you can simply write it.
"Listen (\ d {1,3}. \ D {1,3} \ D {1,3}. \ D {1,3})"< / Pre>only matches IP addresses with spaces:
127 0. 0 1If you want to make them optional Then add * later:
"Listen * (\ D {1,3}. \ D {1,3}. \ D {1,3} . \ D {1,3}) "After the" Listen "location after the notice allows extra space. Example:
listen to 127.0.0.1If you want to match the IP address with this address port
"Listen * (\ d {1,3} \. \ D {1,3} \. \ D {1,3} \. \ D {1,3}): \ D {1,5}" < / Code>If you want to print the matched value again, it is usually written as \ 1 (\ 2, ...)
C: \ H \ httpd.conf | Repl "listen (\ d {1,3} \. \ D {1,3} \. \ D {1,3} \. \ D {1,3}): (\ D {1,5})" Listen = "& gt; C: \ h \ h.confListen 127.0.0.1:8080 << Listen =
< Pre>type C: \ h \ httpd.conf | repl "listen (\ d {1,3} \. \ D {1, 3} \. \ D {1,3} \. \ D { 1,3}): (\ d {1,5}) "" listen = \ 1 "& gt; c: \ h \ h conf
( probably ) Listen to 127.0.0.18080 Listen = 127.0.0.1
Hope that helps.
Comments
Post a Comment