Regex comments not working
Forum rules
READ THIS AND DO IT!!!
Please include the following information:
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).
We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.
When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".
READ THIS AND DO IT!!!
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).
-
Muroph
- Posts: 561
- Joined: 21 Aug 2007 16:13
Regex comments not working
Hey, its me again!
I usually add a comment as a title to the expressions in the RegExp Rename list.
Like this:
(?#ren 1st num)\D*(\d+).*(\.[0-9A-z]*$)>filename_$1$2
This should rename the file using the 1st sequence of numbers and the extension.
But it gives a syntax error message.
All regex with comments do.
The only way I found to avoid the error is to remove the comments.
The thing is: I've been using comments for a long time in v6.10 with no problems (using 6.20 now).
The expressions also worked with a regex debugger.
So... Is this a bug or I'm doing something wrong?
I usually add a comment as a title to the expressions in the RegExp Rename list.
Like this:
(?#ren 1st num)\D*(\d+).*(\.[0-9A-z]*$)>filename_$1$2
This should rename the file using the 1st sequence of numbers and the extension.
But it gives a syntax error message.
All regex with comments do.
The only way I found to avoid the error is to remove the comments.
The thing is: I've been using comments for a long time in v6.10 with no problems (using 6.20 now).
The expressions also worked with a regex debugger.
So... Is this a bug or I'm doing something wrong?
-
admin
- Site Admin
- Posts: 66431
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Regex comments not working
Nothing was changed in 6.2 concerning RegExp. I tried your example with 6.10 and it fails as well.Muroph wrote:The thing is: I've been using comments for a long time in v6.10 with no problems (using 6.20 now).
FAQ | XY News RSS | XY X
-
Muroph
- Posts: 561
- Joined: 21 Aug 2007 16:13
I just found this:
"Regex comments are supported by the JGsoft engine, .NET, Perl, PCRE, Python and Ruby."
"Java (...) doesn't support (?#)-style comments."
Maybe this is the cause.
And... well... I forgot a little detail...
I always erased the comments before applying the regex, so the templates would stand out in the history.
Really sorry about that...
Ah! Maybe THIS is a bug, but I won't create a new topic for it.
When you hit the shortcut 'Miscellaneous / Tree / Fully Collapse Drive' the tab/list also goes to the drive location.
"Regex comments are supported by the JGsoft engine, .NET, Perl, PCRE, Python and Ruby."
"Java (...) doesn't support (?#)-style comments."
Maybe this is the cause.
And... well... I forgot a little detail...
I always erased the comments before applying the regex, so the templates would stand out in the history.
Really sorry about that...
Ah! Maybe THIS is a bug, but I won't create a new topic for it.
When you hit the shortcut 'Miscellaneous / Tree / Fully Collapse Drive' the tab/list also goes to the drive location.
-
jacky
- XYwiki Master
- Posts: 3106
- Joined: 23 Aug 2005 22:25
- Location: France
- Contact:
Yes, MS/VB engine used by XY does not support comments, so nothing Don can do about it.
Same apply here, it's even hinted in the description: "Fully collapse the current drive (resp. \\Server, Desktop, MyDocuments) in Tree. Select and focus the drive root."
Of course it does, since you cannot be on a location not shown on Tree! As soon as you collapse a parent folder of your current location, you'll jump to that parent.Muroph wrote:When you hit the shortcut 'Miscellaneous / Tree / Fully Collapse Drive' the tab/list also goes to the drive location.
Same apply here, it's even hinted in the description: "Fully collapse the current drive (resp. \\Server, Desktop, MyDocuments) in Tree. Select and focus the drive root."
Proud XYplorer Fanatic
-
admin
- Site Admin
- Posts: 66431
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Oh, I can: cut the comment!jacky wrote:Yes, MS/VB engine used by XY does not support comments, so nothing Don can do about it.
FAQ | XY News RSS | XY X
-
jacky
- XYwiki Master
- Posts: 3106
- Joined: 23 Aug 2005 22:25
- Location: France
- Contact:
Oh yeah, you could do this... you almost got ir right, syntax is (?#comment)admin wrote:Oh, I can: cut the comment!jacky wrote:Yes, MS/VB engine used by XY does not support comments, so nothing Don can do about it.Help me, what's the comment syntax? Start with "(?", end with ")" ??
Proud XYplorer Fanatic
-
admin
- Site Admin
- Posts: 66431
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Always at the beginning? Or anywhere? If anywhere, are multiple comments allowed?jacky wrote:Oh yeah, you could do this... you almost got ir right, syntax is (?#comment)admin wrote:Oh, I can: cut the comment!jacky wrote:Yes, MS/VB engine used by XY does not support comments, so nothing Don can do about it.Help me, what's the comment syntax? Start with "(?", end with ")" ??
FAQ | XY News RSS | XY X
-
jacky
- XYwiki Master
- Posts: 3106
- Joined: 23 Aug 2005 22:25
- Location: France
- Contact:
no, classic regexp pattern, so it's anywhere and multiple comments are allowed yes. And make sure there's no backslash ( \ ) before, because if the parenthesis is escaped then it's not a comment, obviously!admin wrote:Always at the beginning? Or anywhere? If anywhere, are multiple comments allowed?
BTW, I'm sure it's on your list already somewhere
Even a simple "Test/Preview" button on the window, that would popup the results for selected List items would be nice. Or even only the focused one, just something to make sure.
Proud XYplorer Fanatic
-
admin
- Site Admin
- Posts: 66431
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
You don't happen to have a RegExp handy that removes those comments?jacky wrote:no, classic regexp pattern, so it's anywhere and multiple comments are allowed yes. And make sure there's no backslash ( \ ) before, because if the parenthesis is escaped then it's not a comment, obviously!admin wrote:Always at the beginning? Or anywhere? If anywhere, are multiple comments allowed?
BTW, I'm sure it's on your list already somewherebut for RegExp rename some kind of preview would be great, to make sure we're not about to screw up all the names.
Even a simple "Test/Preview" button on the window, that would popup the results for selected List items would be nice. Or even only the focused one, just something to make sure.
Yes, it's on my list. I'm aware of the importance. I just put "rename preview" on the roadmap to give it more gravity...
FAQ | XY News RSS | XY X
-
jacky
- XYwiki Master
- Posts: 3106
- Joined: 23 Aug 2005 22:25
- Location: France
- Contact:
hehe... Well, that one would do it I think :admin wrote:You don't happen to have a RegExp handy that removes those comments?Looks like a typical RegExp job...
Code: Select all
(?<!\\)\(\?#.*?\)Makes me feel much better alreadyadmin wrote:Yes, it's on my list. I'm aware of the importance. I just put "rename preview" on the roadmap to give it more gravity...
Proud XYplorer Fanatic
-
admin
- Site Admin
- Posts: 66431
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Sure about the backslashes? No word about them here: http://www.regular-expressions.info/comments.htmljacky wrote:no, classic regexp pattern, so it's anywhere and multiple comments are allowed yes. And make sure there's no backslash ( \ ) before, because if the parenthesis is escaped then it's not a comment, obviously!admin wrote:Always at the beginning? Or anywhere? If anywhere, are multiple comments allowed?
FAQ | XY News RSS | XY X
-
jacky
- XYwiki Master
- Posts: 3106
- Joined: 23 Aug 2005 22:25
- Location: France
- Contact:
Yeah i'm sure, it's a common regexp thing that's why it's not mentioned here or everywhere. And I do use EditPadPro (same author as this website) every day and tested with it just to be sureadmin wrote:Sure about the backslashes? No word about them here: http://www.regular-expressions.info/comments.html
It's mentioned here: http://www.regular-expressions.info/characters.html#qe
PS: EditPadPro is the best text editor out there. It's like the XY of text editors!
Proud XYplorer Fanatic
-
Muroph
- Posts: 561
- Joined: 21 Aug 2007 16:13
So this is how it works...jacky wrote:Of course it does, since you cannot be on a location not shown on Tree! As soon as you collapse a parent folder of your current location, you'll jump to that parent.
Same apply here, it's even hinted in the description: "Fully collapse the current drive (resp. \\Server, Desktop, MyDocuments) in Tree. Select and focus the drive root."
I havent noticed the end of the description.
Hmm...
Is there a way to collapse everything except the current location?
Because sometimes the tree gets really big and difficult to work with.
Yeah, this would be great!jacky wrote:BTW, I'm sure it's on your list already somewhere but for RegExp rename some kind of preview would be great, to make sure we're not about to screw up all the names.
Even a simple "Test/Preview" button on the window, that would popup the results for selected List items would be nice. Or even only the focused one, just something to make sure.
And maybe add something like a 'favorite expressions' list, where you could have some patterns separated from the history of expressions.
This way it'd be easier to use common patterns, not having to search in the mess the history can be if you dont clean it often.
-
admin
- Site Admin
- Posts: 66431
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Yes, it's called "Rebuild Tree" (Ctrl+Shift+F4).Muroph wrote:Is there a way to collapse everything except the current location?
Because sometimes the tree gets really big and difficult to work with.
Yes, I heard this wish before. I see the point, but after all XY is not a file renamer. Other things are more important and will be done first...Muroph wrote:And maybe add something like a 'favorite expressions' list, where you could have some patterns separated from the history of expressions.
This way it'd be easier to use common patterns, not having to search in the mess the history can be if you dont clean it often.
FAQ | XY News RSS | XY X
-
admin
- Site Admin
- Posts: 66431
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Regex comments not working
The next BETA version will remove the comments for you.Muroph wrote:(?#ren 1st num)\D*(\d+).*(\.[0-9A-z]*$)>filename_$1$2
This should rename the file using the 1st sequence of numbers and the extension.
But it gives a syntax error message.
All regex with comments do.
The only way I found to avoid the error is to remove the comments.
FAQ | XY News RSS | XY X
XYplorer Beta Club