in reply to Re: How to extract special charachetrs like <=, >= != from string
in thread How to extract special charachetrs like <=, >= != from string

We can even shorten this with character class []

use strict; use warnings; use Data::Dumper; while(<DATA>) { print "$1\n" if($_ =~ /([><=!]+)/g) } __DATA__ $this vinoth $that $this >= $that $this gt $that $this != $that $this ne $that $this == $that $this eq $that

All is well. I learn by answering your questions...
  • Comment on Re^2: How to extract special charachetrs like <=, >= != from string
  • Download Code

Replies are listed 'Best First'.
Re^3: How to extract special charachetrs like <=, >= != from string
by Anonymous Monk on Aug 14, 2015 at 08:13 UTC
    Hi all,

    Solution provided by james28909 did work for me.

    thanks --girija
Re^3: How to extract special charachetrs like <=, >= != from string
by james28909 (Deacon) on Aug 14, 2015 at 05:52 UTC
    My question to this is, how does it know to print the = after the ><=! ? Maybe i am missing a key piece of data/knowledge which would not surprise me lol.
      Because of the +.
      لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
      actually, it matches also =>, <>, !!, <=>, or in fact any combination of these four characters. It says "match these characters, one or more times".
      If you want only one of the 4 characters followed by a single "=", you'd write [!<=>]=
      ++choroba

      james28909, It could be great if you read this line + Match 1 or more times from the link you shared Regular Expressions


      All is well. I learn by answering your questions...
        For some reason I thought that meant the same character haha. I thought it would matched the character 'a' or 'aaaaa' not 'ab' or 'a3' ect. Anyways, i learn something new everyday I recon haha.