SPUG: RegEx
Dan Ebert
mathin at mathin.com
Fri Sep 7 14:44:42 CDT 2001
Would something like this do the trick?
<code>
#!/usr/bin/perl
use strict;
my $string = '6-2 Dual Mode Selection';
print $string,"\n";
$string =~ s/(\d)\s+([A-Z])/$1replacement$2/g;
print $string,"\n";
</code>
-----------------------------------------------------
Lewis's Law of Travel:
The first piece of luggage out of the chute doesn't
belong to anyone, ever.
-----------------------------------------------------
On Fri, 7 Sep 2001, Brittingham, John wrote:
>
> I am trying to replace a white space that lies between an number and a
> capital letter without changing either the number or the letter. I can't
> find any examples on this.. Can anyone tell me how to do this?
>
> example:
> 6-2 Dual Mode Selection...... separating out Dual Mode Selection from 6-2
>
> Thanks jb
>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/
More information about the spug-list
mailing list