multi-char pattern with other patterns 
Author Message
 multi-char pattern with other patterns

I want to do this:
"hello - world" ==> "hello-world"
"hello                  -      world" ==> "hello-world"
"hello - world_good-bye world save ^%^&^&^me" ==>
"hello-world_good-bye_world_save_me"

with one line of code.

here's what I have:


    if ($line =~ / /){
        $orig=$line;
        ($mod=$line) =~ s/ /_/g; #space to underscore
        $mod =~ s|[^_ -[:alnum:]]||g;
        $mod =~ s|_-_|-|g;

        print "$orig ==> $mod\n";
    }

Quote:
}

that's a mouth full.


Tue, 13 Sep 2005 07:12:03 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. multi pattern substite on multi-files

2. pattern matching with special char

3. How can I pattern match a dos formated string (ctrl-m chars)

4. How Do You Pattern Match For \n Char?

5. "Multi-line" patterns

6. regex to match a multi line pattern

7. Multi-Line Pattern Sarches

8. help with multi-line pattern requested

9. multiline, multi pattern match

10. Multi line pattern matches?

11. Pattern bug matching whitespace in multi-line match?

12. Multi-line pattern matching?

 

 
Powered by phpBB® Forum Software