Jump to content

regex halp


andytan91

Recommended Posts

hello guys i have been trying to regex this string..$blackhole contains "nul"..may i ask what do i need to edit from my current regex? thanks!

 

if %errorlevel% neq 0 ( echo Access This Computer From the Network: Pass >> C:\final.txt) else ( echo Access This Computer From the Network: Fail >> C:\final.txt)

 

$batch_contents = preg_replace('~(if %errorlevel% neq 0 \( echo Access This Computer From the Network: Pass >> )([a-zA-Z0-9-_.*]+)(\) else \( echo Access This Computer From the Network: Fail >> )([a-zA-Z0-9-_.*]+)(\))~','${1}'.$blackhole.'${3}'.$blackhole,$batch_contents); 

Link to comment
https://forums.phpfreaks.com/topic/210056-regex-halp/
Share on other sites

hello guys i am trying to preg_replace this line --> $parts = preg_split("/\.\(.*\)\.\(.*\)/", $file);

 

The bold characters ".*" is what i am intending to replace with numbers and strings...i hope you guys can help me..

 

This is the closest i can get to

$batch_contents = preg_replace('~(preg_split\("/\\\\.\\\\(\.\*\\\\)\\\\.\\\\()([0-9.]+)(\\\\))~i', '${1}'.$newArgument, $batch_contents);

 

 

Link to comment
https://forums.phpfreaks.com/topic/210056-regex-halp/#findComment-1097286
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.