andytan91 Posted August 7, 2010 Share Posted August 7, 2010 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 More sharing options...
andytan91 Posted August 7, 2010 Author Share Posted August 7, 2010 ahh nevermind...i solved it..thanks all Link to comment https://forums.phpfreaks.com/topic/210056-regex-halp/#findComment-1096284 Share on other sites More sharing options...
andytan91 Posted August 10, 2010 Author Share Posted August 10, 2010 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.