Title

Message

Confirm

<< DiscussionsReply

problem with macro and regex

Avatar from Gravatar.com
Rami Magdi30585
3 discussion posts
this is a macro i created

Code


========

1- the macro is applied to what is already in the clipboard with the assigned (shift+ctrl+c) . how can i make it copy and then apply the function?

2- i wanted to use this here but it give doesn't work !!

Code



i found the ugly that works but not really self explanatory

Code



can you help modify this to work?

Code

Oct 8, 2020 (modified Oct 8, 2020)  • #1
Keith Lammers (BFS)'s profile on WallpaperFusion.com
You can use
text= BFS.Clipboard.CopyText();
to have the macro grab the currently highlighted text.

As for this regex statement:
[\\/:"*?<>|]
. What doesn't work about it? Do you get an error? Or does the macro run but it doesn't match what you're expecting it to?
Oct 15, 2020 (modified Oct 15, 2020)  • #2
Avatar from Gravatar.com
Rami Magdi30585
3 discussion posts
Oct 15, 2020  • #3
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Ah, it's treating the quotation mark in the middle of that regex statement as the end of that parameter. You need to escape it with a backslash, like this:

"[\\/:\"*?<>|]"


If those two backslashes are literal as well, you need to escape each one as well, so it would be like this:

"[\\\\/:\"*?<>|]"


When you do \\ inside the quoted parameter, it's treated as one backslash. And when you do \" inside the quoted parameter, it's treated as just ".

Hope that makes sense!
Oct 16, 2020  • #4
Avatar from Gravatar.com
Rami Magdi30585
3 discussion posts
Thank you very much
it works perfectly
i would have never thought of that much escaping!
Oct 16, 2020  • #5
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Haha, no worries!
Oct 16, 2020  • #6
Was this helpful?  (1)  
<< DiscussionsReply