zeenmakr Posted February 6, 2020 Share 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() Link to comment Share on other sites More sharing options...
mikell Posted February 6, 2020 Share 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 Danyfirex 1 Link to comment Share on other sites More sharing options...
Nine Posted February 6, 2020 Share 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 seadoggie01 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
iamtheky Posted February 6, 2020 Share Posted February 6, 2020 doesnt Tidy do this? seadoggie01 1 ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Developers Jos Posted February 6, 2020 Developers Share 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now