Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure?

User Image
Rami Magdi30585
6 discussion posts
this is a macro i created

Code

using System;
using System.Text.RegularExpressions;

public static class ClipboardFusionHelper
{
public static string ProcessText(string text)
{

text = Regex.Replace(text, "\\n", " ");

text = Regex.Replace(text, "[^a-zA-Z0-9\u0080-\uFFFF.,%_–-]", " ");

text = Regex.Replace(text, "(\\s+)", " ");

return text;
}
}

========

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

[^a-zA-Z0-9\u0080-\uFFFF.,%_–-]


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
User Image
Rami Magdi30585
6 discussion posts
https://i.postimg.cc/sXGy7MWz/Untitled-2.jpg
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
User Image
Rami Magdi30585
6 discussion posts
Thank you very much
it works perfectly
i would have never thought of that much escaping!:laugh:
Oct 16, 2020  • #5
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Haha, no worries!
Oct 16, 2020  • #6
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(1)  Login to Vote(-)