[EMAIL PROTECTED] (Jerry Preston) wrote: > I am trying to figure out a way to remove the c pointers from the > following: > > *ci = *ci * (1.0 + ((gi/(w * *ci)) * (gi/(w * *ci)))); > > so that it will end ou as the following: > > ci = ci * (1.0 + ((gi/(w * ci)) * (gi/(w * ci))));
Not really difficult, if you know a little about regex. Have a look at perldoc perlre. BTW, here are some ways (assume my $string = '*ci = *ci * (1.0 + ((gi/(w * *ci)) * (gi/(w * *ci))))': ) 1. Simplest: $string =~ s/\*ci/ci/g; It searches for a literal "*" followed by the two letters "ci" and replace it all with the letters "ci". The g modifier after the pattern tells perl to do replacements all over the string. 2. More elegant: $string =~ s/\*(?=ci)//g; This does a "look-ahead assertion", i.e. searches for a literal "*" followed by the string "ci" (without including the string in the match) and replace it with nothing. 3. Generalized: $string =~ s/\*(?=[a-z]+)//g; Here you can match *any* literal "*" in your program followed by a valid string (read below) and remove it. Please note that the [a-z]+ is just an example. I don't know C so i can't say what are valid strings for variables. If you want to include all alphanumerics plus "_" you say [a-zA-Z0-9_] which becomes simply \w, and so on. Again, read perldoc perlre. You may want to add checks for a space before the "*". Hope this is a good starting point. -- Zanardi2k3 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]