 |
| XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

July 25th, 2008, 10:12 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Posts: 291
Thanks: 9
Thanked 29 Times in 29 Posts
|
|
replace text without using regex
In there any way to replace text without using regex.
Input: M19999991999999
Ootput: ,
any help is appreciated
__________________
Rummy
|
|

July 25th, 2008, 03:12 PM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
>In there any way to replace text without using regex.
Yes, for example you can use translate() or you can use combinations of concat(), substring() substring-before(), etc.
>Input: M19999991999999
>Ootput: ,
That's a bit like saying
>Input: What is the meaning of life?
>Output: 42
and expecting someone to come up with an algorithm.
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference
|
|

July 25th, 2008, 03:52 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
|
|
>Input: What is the meaning of life?
>Output: 42
Algorithm: Add the fourth smallest prime number to itself one more times than the value of that same number.
(Well, you didn't ask for a *correct* algorithm. <grin/>)
|
|

July 25th, 2008, 04:50 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Posts: 291
Thanks: 9
Thanked 29 Times in 29 Posts
|
|
Thank you.
Can anyone help me to get the regex to find
1,[ and ]1,
|
|

July 25th, 2008, 05:12 PM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
Try
1,\[
\]1,
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference
|
|

July 25th, 2008, 05:22 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Posts: 291
Thanks: 9
Thanked 29 Times in 29 Posts
|
|
Mike, its not working.
I want to find ]1, and replace it with ],
1 can be any number.
thanks
|
|

July 25th, 2008, 06:44 PM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
If you want to match any number, then say so, don't say you want to match "1". You really need to learn to express your requirements more clearly, until you learn to phrase your questions correctly you will never get useful answers.
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference
|
|

July 28th, 2008, 09:12 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Posts: 291
Thanks: 9
Thanked 29 Times in 29 Posts
|
|
I should thank you for teaching these things. Sorry for that Mike.
|
|
 |