Regex on windows
-
I have some issues with regex on Windows.
I finished my project on Mac and i opened it on Windows but it looks like regex not working.
On Mac i using regex to cut file name and push it to array but on windows it's not working and i see whole path to file insted (f.ex. file.wav).
-
BUMP
On mac i have
var regexed = Engine.getRegexMatches(p, "[^/]*$");
any idea how make it work on windows?
-
I also don't know why strings in my path array in ScripWatchTable looks like this
"C:\\Users\\armin\\AppData\\Roaming\\My Company\\Demo Plugin\\AudioFiles\\factory_1.wav",
and when i Console.print it it looks normal (single slash)
-
Windows uses
\
as a directory separator. Sensible operating systems use/
.\
is also an escape character, so when you try to write a directory name on Windows you have to use\\
one is the directory separator, the other is the escape character to tell Windows that the other one is the directory separator and not an escape character :pAnother solution (in the command line at least) is to place the path in quotes
""
and just use one\
-
@d-healey ok thanks for explanation but i still don't know how to fix it :D I hate regex.
-
@arminh said in Regex on windows:
@d-healey ok thanks for explanation but i still don't know how to fix it :D I hate regex.
I'm not good with regex which is why I avoided answering the question :p
-
@d-healey anyway, thanks :D I'm currently in the moment that I can pull out a file extension :D Wish me luck.
-
ANSWER IS
[^\\\\]*$
-
If you need to distinguish the regexes based on the OS, use
Engine.getOS()
... -
@Christoph-Hart thanks :)
-
@arminh Bro, What This Regex Thing Stands For?
Where You Find Your Self To Use This Code? -