zeenmakr 8 Posted February 6, 2020 Hi, I was only be able to do this in Notepad++ partially. But can't replicate in SciTE. What I need to do is copy the function name and paste it couple lines down at the end of of another line. Thanks ;Code works in Notepad++ partially but not in SciTE RegEx Find: ^\b(Func)\b\s(.*?)([\(])(.*)([\)])(.*?)$ Replace: $1 $2$3$4$5$6 ;===>$2$3$5 From: Func MyFunc($str) ;copy this function name MyFunc() then paste behind EndFunc below ConsoleWrite($str&@LF) EndFunc To: Func MyFunc($str) ConsoleWrite($str&@LF) EndFunc ;===>MyFunc() ;<--Result in the comment behind EndFunc with MyFunc() Share this post Link to post Share on other sites
mikell 1,014 Posted February 6, 2020 (edited) $txt = "Func MyFunc($str) ;copy this function name MyFunc() then paste behind EndFunc below" & @crlf & _ " ConsoleWrite($str&@LF)" & @crlf & _ "EndFunc" Msgbox(0,"before", $txt) $res = StringRegExpReplace($txt, '(?ms)^Func\h+(\w+).*?\K(?<=^EndFunc)', " ;===> $1()") Msgbox(0,"after", $res) Edit : some comments \w+ can be used because a func name may contain only letters/digits/underscores\K means : "please don't touch the above" (?<=^EndFunc) lookbehind, it matches the place right after the next "EndFunc" preceded by a start of line (allowed by the (?m) multiline option)(?s) allows .*? to match newlines Edited February 6, 2020 by mikell 1 Danyfirex reacted to this Share this post Link to post Share on other sites
Nine 934 Posted February 6, 2020 (edited) @mikell I think OP meant to run it from the editor Scite (Ctrl-h) not from a script. Edited February 6, 2020 by Nine 1 seadoggie01 reacted to this Not much of a signature, but working on it... Spoiler Block all input without UAC Save/Retrieve Images to/from Text Tool to search content in au3 files Date Range Picker Sudoku Game 2020 Overlapped Named Pipe IPC x64 Bitwise Operations Fast and simple WCD IPC GIF Animation (cached) Share this post Link to post Share on other sites
iamtheky 927 Posted February 6, 2020 doesnt Tidy do this? 1 seadoggie01 reacted to this ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Share this post Link to post Share on other sites
Jos 2,177 Posted February 6, 2020 4 minutes ago, iamtheky said: doesnt Tidy do this? yeap.... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Share this post Link to post Share on other sites