Thread View: adobe.scripting.indesign
4 messages
4 total messages
Started by Fred_Goldman
Fri, 09 Jan 2009 01:06
[JS] Return search results
Author: Fred_Goldman
Date: Fri, 09 Jan 2009 01:06
Date: Fri, 09 Jan 2009 01:06
8 lines
902 bytes
902 bytes
Is there any way is JS to search a string for a RegEx and return the results? For example: myString = "hello2009" myDigits = myString.search(/\d+/) Currently myDigits = "0". How do I make myDigits = "2009"?
Re: [JS] Return search results
Author: Gary_Vidal
Date: Fri, 09 Jan 2009 01:57
Date: Fri, 09 Jan 2009 01:57
2 lines
649 bytes
649 bytes
myString.match(/\d+/); Returns 2009
Re: [JS] Return search results
Author: Peter Kahrel
Date: Fri, 09 Jan 2009 08:01
Date: Fri, 09 Jan 2009 08:01
3 lines
711 bytes
711 bytes
.match() returns an array. To return a string, do myString.match(/\d+/)[0] Peter
Re: [JS] Return search results
Author: Fred_Goldman
Date: Fri, 09 Jan 2009 13:34
Date: Fri, 09 Jan 2009 13:34
1 lines
772 bytes
772 bytes
Thanks Gary and Peter, that's what I was looking for.
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