Converting a reference string to lowercase

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
brynlund
Posts: 4
Joined: Fri Feb 15, 2008 8:00 am

Converting a reference string to lowercase

Post 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?
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Post by DataMystic Support »

Yes, add a Convert to lowercase subfilter, and the entire replacement will become lowercase.
brynlund
Posts: 4
Joined: Fri Feb 15, 2008 8:00 am

Post 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?
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Post 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
    
brynlund
Posts: 4
Joined: Fri Feb 15, 2008 8:00 am

Post 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?
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Post 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.
brynlund
Posts: 4
Joined: Fri Feb 15, 2008 8:00 am

Post by brynlund »

Where would I find the action field in version 6.5.1? I've looked and can't find it anywhere.
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Post by DataMystic Support »

It doesn't exist.

You need 7.8.10 or higher.
Post Reply