Thread View: adobe.scripting.indesign
3 messages
3 total messages
Started by loic_aigon
Fri, 23 Jan 2009 21:58
[JS CS3] Grep difficulty
Author: loic_aigon
Date: Fri, 23 Jan 2009 21:58
Date: Fri, 23 Jan 2009 21:58
15 lines
1159 bytes
1159 bytes
Hi,
I succeeded creating a grep pattern which is used for a string replacement.
var myRegExp = new RegExp ("\..-.*.indd")
if the string is like this, it runs very well :
var x = "001296.01.A-ATELIER GLOTIN.indd";
but like this, it's not satisfying :
var x = "001296.01.ABC-ATELIER GLOTIN.indd";
I cant't get a grep search for a dot, any character n times, a dash, any character n times, a dot, and indd string.
if I do this, var myRegExp = new RegExp ("\..*-.*.indd"), it removes almost everything in the string
What I do wrong ? I am seraching on all grep sites but can't find any clue.
Thanks for light, Loic
Re: [JS CS3] Grep difficulty
Author: Peter Kahrel
Date: Fri, 23 Jan 2009 22:16
Date: Fri, 23 Jan 2009 22:16
5 lines
641 bytes
641 bytes
Loic, Try this: x.match (/\.[^.]+-.+\.indd/) Peter
Re: [JS CS3] Grep difficulty
Author: loic_aigon
Date: Fri, 23 Jan 2009 22:59
Date: Fri, 23 Jan 2009 22:59
4 lines
770 bytes
770 bytes
Hi Peter, Thanks for help, It runs as you may expect it ;-) For a developpement profane such as me, Grep appears as powerful than mysterious.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads