|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Regular Expressions....
Hi,
I need a regular expression that replaces all backslashes in a string with double backslashes. In fact I want to use it in JavaScript, but as Perl is the real text search and replace language I thought I'd ask it here. I think my regular expression to detect the backslashes should be something like this : //// But I don't know if this detects all the occurrences of the backslash in the string. Any help on this would be highly appreciated! Thanks, Iwan |
|
#2
|
|||
|
|||
|
one of the solutions are ....
Hi, vdschoor
The following codes will work. I tested myself! and backslash is \ not / isn't it ? ^^; #!/usr/bin/perl $tar = "ja\\ja\\"; print $tar; print "\n"; $tar =~ s/\\/\\\\/g; print $tar; exit; The result is ja\ja\ ja\\ja\\ |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > Regular Expressions.... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|