Re: substition in perl



Bart Van der Donck wrote:
dennisha...@xxxxxxxxx wrote:

s/PATTERN/REPLALCEMENT/

and explains that the operator searches a string for PATTERN and
replaces that match with the REPLACEMENT text.

My question then is this. What string is being searched? The
documention goes on to say that if no string is specified, the $_
variable is search.

PATTERN is searched and replaced by REPLACEMENT.

No. PATTERN is what's being searched for. $_ (or whatever variable is
bound do the s///) is what's being searched. Very different.

Paul Lalli

.



Relevant Pages

  • Re: [PHP] ereg_replace with user defined function?
    ... With a preg_replace_callback I am able to look for a pattern like: a number followed by whitespace followed by one, two, three or more characters, followed by a closing character. ... In that function I evaluate the unit, see if it is in my array containing the conversion "table". ... The metric / imperial calculations / replacements take between 0.00054 and 0.005 seconds per table cell / text string. ... replacement with preg_replace_callback compared to the function I wrote? ...
    (php.general)
  • multiple pattern replacement using regular expressions
    ... I needed to write an efficient pattern replacement class which could use ... Replaces multiple patterns within given string based on regular ... @param pattern a simple string or a regular expression ...
    (comp.lang.java.programmer)
  • Re: substition in perl
    ... The documentation shows the syntax as ... What string is being searched? ... PATTERN is searched and replaced by REPLACEMENT. ...
    (comp.lang.perl.misc)
  • Re: Predicting the Future and Kolmogorov Complexity
    ... Predictability is based on the pattern itself. ... addition to the string. ... For any prediction scheme, there are computable strings that show no ... Out of this hole comes a ~2 cm blue marble followed by a red ...
    (talk.origins)
  • Re: macro for parsing text
    ... SUB will remove from any cell selected the pattern as you described (i.e. ... Dim c As Range ... Dim Temp As String ... Dim colMatches As MatchCollection ...
    (microsoft.public.excel.programming)