Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: left side of pattern matching

by furry_marmot (Pilgrim)
on Mar 13, 2012 at 20:13 UTC ( #959443=note: print w/replies, xml ) Need Help??

in reply to left side of pattern matching

They are "converted" (interpolated, actually), but you are matching apples to apples, so it doesn't matter. First, the backslash is simply a representation of an "invisible" character. It's not as simple as "removing the backslash".

Context is also very important. In a double-quote interpolated string, a pipe '|' is just a pipe. But in a regex, it takes on the meaning of OR in a match. Here's the string you created, translated a bit:
$hello = "^<newline><space><pipe><tab><carriage return>$"
I think this is exactly what you expected. Then you set up a match, wherein you ask:
Does $hello contain one or more of [<space><pipe><tab><carriage return><newline>], which start at the beginning of the string, and end at the end of +the string (this is called anchoring, by the way)?

And yes it does, as noted above. I'm not sure why you would think it wouldn't match. Regexes are interpolated similarly to quoted strings, but there are additional meanings within a regex that also have to be considered.

Instead of worrying about passes of interpretation or whatever, just think about what each special character means in the context in which you are using it.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://959443]
[choroba]: Slidy is basically HTML, so I'm not sure I really fly high :)
choroba should make his presentation scaffolding public
[Corion]: choroba: spod5 converts pod to S5 HTML, so it's also still basic. I find the lack of animations (in the sense of "highlight this", "highlight that" in code) somewhat tedious as I do it with rendered PNGs
[Corion]: I haven't found a good way to include/use the source SVGs I use for creating the PNGs directly as animations
[ambrus]: Presentations come in many different shapes, and so slides do as well.
[Corion]: Doing that in Powerpoint or Ooxml would be nice(r) but I'm much quicker doing the outline of a presentation and the code as Pod
[Corion]: Hurrr - on a machine that is behaving weirdly, I have two processes CROND running. I guess that is the source of unattended jobs sometimes not finding their files anymore...
[ambrus]: Most of the time if I make slides, they're just a formatted document with a medium level of formality (between a well written article and an informal draft), with usually the page breaks chosen carefully and possibly some content repeated between pages.
[Corion]: ambrus: My slides are mostly a list of things I want to talk about. But sometimes I want to point out interesting parts, or build up a larger image from small components. This is where animations/ highlights would come in well
[choroba]: what I like about slides in HTML + CSS is I can use templates to produce them, which means all code in slides is tested, and I can version them in git

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (12)
As of 2017-09-26 10:06 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (293 votes). Check out past polls.