Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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
 
Old July 25th, 2008, 10:12 AM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 291
Thanks: 9
Thanked 29 Times in 29 Posts
Default replace text without using regex

In there any way to replace text without using regex.

Input: M19999991999999
Ootput: ,

any help is appreciated

__________________
Rummy
 
Old July 25th, 2008, 03:12 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

>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
 
Old July 25th, 2008, 03:52 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

>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/>)
 
Old July 25th, 2008, 04:50 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 291
Thanks: 9
Thanked 29 Times in 29 Posts
Default

Thank you.

Can anyone help me to get the regex to find
1,[ and ]1,


 
Old July 25th, 2008, 05:12 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Try

1,\[

\]1,

Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference
 
Old July 25th, 2008, 05:22 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 291
Thanks: 9
Thanked 29 Times in 29 Posts
Default

Mike, its not working.
I want to find ]1, and replace it with ],

1 can be any number.

thanks

 
Old July 25th, 2008, 06:44 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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
 
Old July 28th, 2008, 09:12 AM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 291
Thanks: 9
Thanked 29 Times in 29 Posts
Default

I should thank you for teaching these things. Sorry for that Mike.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Issue with replace function using regex avator BOOK: Beginning Regular Expressions 0 May 26th, 2008 03:46 AM
urgent: RegEx to read a Text File jeusdi .NET Framework 1.x 1 February 8th, 2007 11:42 AM
Text Replace with XSLT pendyalap XSLT 13 October 1st, 2006 05:51 PM
Checking regex with replace and URI test rjonk XSLT 1 July 28th, 2006 05:19 PM
Replace text fragments janise MySQL 5 November 1st, 2004 04:43 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.