Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


Ujma
  •  Ujma
  • Paid support Topic Starter
2020-06-23T22:51:34Z
Hello,

I have Question, how can I remove "-", "blank Space", "()" from a file name like using single Regex and replace all of these with "_"

For example file name is like this : xyz abc asd April 28 2020 - xyz(1)_2020_06_18_1523

Can someone please help me with this.

Thank You.
Sponsor
Forum information
Gary_W
2020-06-24T13:39:23Z
I see you started a new question so I'll post my reply here too.

Not sure what your approach is but a regex to do it is:

{REGEX(Replace|xyz abc asd April 28 2020 - xyz(1)_2020_06_18_1523|[- ()_]+|_)}

Result (note you will get multiple underscores in a row so the underscore needs to be part of the match set):

xyz_abc_asd_April_28_2020_xyz_1_2020_06_18_1523

Regex explained:

[] - defines a character set
[- ()_] - inside the set are the characters dash, space, open and close parens and an underscore. The underscore needs to get matched too for the following regex match character.
+ - Match 1 or more of the previous character
So it means match 1 or more of the previous characters and replace with a single underscore
Support
2020-06-24T14:51:13Z
Originally Posted by: Ujma 

Hello,

I have Question, how can I remove "-", "blank Space", "()" from a file name like using single Regex and replace all of these with "_"

For example file name is like this : xyz abc asd April 28 2020 - xyz(1)_2020_06_18_1523

Can someone please help me with this.

Thank You.



Thanks Gary for your suggestion/solution.

Ujima, let us know if Gary's solution works for you in this case.
Michael
Support
http://www.visualcron.com 

Please like  VisualCron on facebook!
Scroll to Top