Page 1 of 1

Converting a reference string to lowercase

Posted: Fri Feb 15, 2008 8:14 am
by brynlund
I am performing the following search and replace:

[Ii]-(\w{3,})-(\d{3,})
(eg. I-ABC-123)

Replace with:

<a href="http://www.xxx.com/dir1/dir2/dir3/i-$1-$2.pdf">$0</a>

This is basically working, however the string that I receive in $1 (in the above example, ABC) is currently in uppercase and I would like to convert it to lowercase in the hyperlink.

Any suggestions?

Posted: Fri Feb 15, 2008 10:31 am
by DataMystic Support
Yes, add a Convert to lowercase subfilter, and the entire replacement will become lowercase.

Posted: Fri Feb 22, 2008 7:01 am
by brynlund
I haven't been able to figure out how to do that. I can't find any examples in the user help files and nothing I've tried actually works. Based on the previous example, what would that look like?

Posted: Fri Feb 22, 2008 7:52 am
by DataMystic Support
See lesson 5 in the help file. (About fifth item down in the contents).

It looks like this:

Code: Select all

Perl pattern [[Ii]-(\w{3,})-(\d{3,}) ] with [<a href="http://www.xxx.com/dir1/dir2/dir3/i-$1-$2.pdf">$0</a> ]
|  [X] Match case
|  [ ] Whole words only
|  [ ] Case sensitive replace
|  [ ] Prompt on replace
|  [ ] Skip prompt if identical
|  [ ] First only
|  [ ] Extract matches
|  Maximum text buffer size 4096
|  [ ] Maximum match (greedy)
|  [ ] Allow comments
|  [X] '.' matches newline
|  [ ] UTF-8 Support
|
+--Convert to lowercase
    

Posted: Thu Feb 28, 2008 6:09 am
by brynlund
The result isn't exactly what I'm after. I'm trying to end up with the following hyperlink:
<a href="http://www.xxx.com/Dir1/Dir2/Dir3/i-$1-$2.pdf">$0</a>

Where parts of the path could potentially be upper and/or lower case. However, I need to make ONLY what appears in the string from $1 to be lowercase, while leaving the rest of the path untouched. The example that you provided me converts the entire hyperlink to lowercase instead of just what appears in $1.

Is this doable?

Posted: Mon Mar 03, 2008 10:37 am
by DataMystic Support
Yes, change the Action field of the search/replace from 'Replace' to 'Send variable 1 to subfilter'. Keep the lowercasing subfilter as before.

Posted: Thu Mar 06, 2008 7:32 am
by brynlund
Where would I find the action field in version 6.5.1? I've looked and can't find it anywhere.

Posted: Thu Mar 06, 2008 8:07 am
by DataMystic Support
It doesn't exist.

You need 7.8.10 or higher.