Difference between /PATTERN/ and ?PATTERN? (+ another pattern ?) 
Author Message
 Difference between /PATTERN/ and ?PATTERN? (+ another pattern ?)

I guess I'm missing something in the camel book, but I don't really get
the difference between /PATTERN/ and ?PATTERN?. Could somebody enlighten
me (possibly with relevant examples)?

Also, let me ask another pattern based question while I've got you reading
this. I'm playing with perl to process packets off the network. I get
these packets as a string. I want to filter certain packets in/out so I
am using the pattern matching stuff. The only thing is, packet data is
not necessarily based on 'lines'. A newline is just another byte. I would
like to do something like:

        $* = 1; # must match across newlines cuz they're not special
        if($packet =~ /^(.|\n){20}${value}/)...

And have the ^ mean "the beginning of the data" and NOT "the beginning of
any line". In other words, how do I insure that my pattern matches ONLY
at the beginning of my data and not somewhere in the middle?


--

...............................................................................
 Art Mellor       : Cayman Systems Inc,  26 Landsdowne St,  Cambridge, MA 02139



Sun, 03 Apr 1994 05:51:31 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. multi-char pattern with other patterns

2. Regular Expressions/Pattern Matching/Unordered pattern

3. How to find pattern in pattern (newbie Q)?

4. ANN: String::Pattern - yet another pattern ( template ) processing module

5. pattern as a sentence in pattern matching

6. help with pattern match (repeated patterns)

7. split() INTO pattern instead of ON pattern?

8. How to use Regex to breakdown a pattern and use the pattern to break down a string

9. Symbols in patterns interpolated *recursively*?

10. Efficiency of some regexp patterns

11. Efficiency of some regexp patterns

12. Efficiency of some regexp patterns

 

 
Powered by phpBB® Forum Software