Have any idea about regular expression ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mo

    Have any idea about regular expression ?

    Have any idea about regular expression ?

    I posted this question to other newsgroup, but I'm still hungry for it.

    I tried to change any numeric characters to Zero like following;
    $aaa = ereg_replace ("|0-9|", "0", $sentence);
    This seems working perfect.

    My question is how I can do this function only for outside of html tags.
    I don't want any numeric characters to be changed inside html tags.

    Thanks for further response.

    Regards,
    Mo


  • Matthias Esken

    #2
    Re: Have any idea about regular expression ?

    "Mo" <mo@naggama.co. kr> schrieb:
    [color=blue]
    > Have any idea about regular expression ?
    >
    > I posted this question to other newsgroup, but I'm still hungry for it.
    >
    > I tried to change any numeric characters to Zero like following;
    > $aaa = ereg_replace ("|0-9|", "0", $sentence);
    > This seems working perfect.
    >
    > My question is how I can do this function only for outside of html tags.
    > I don't want any numeric characters to be changed inside html tags.[/color]

    Give it a try - I didn't try it myself. :-)

    | $aaa = preg_replace("/((<[^>]*)|\d)/e", '"\2"=="\1"? "\1":"0"', $sentence);

    Regards,
    Matthias

    Comment

    • Mo/G&G

      #3
      Re: Have any idea about regular expression ?

      Thanks Matthias

      It works perfect.
      $aaa = preg_replace("/((<[^>]*)|\d)/e", '"\2"=="\1"? "\1":"0"', $sentence);

      Thanks again

      Regards,
      Mo

      "Matthias Esken" <muelleimer2003 nospam@usenetve rwaltung.org> wrote in
      message news:blv47q.1l0 .1@usenet.esken .de...[color=blue]
      > "Mo" <mo@naggama.co. kr> schrieb:
      >[color=green]
      > > Have any idea about regular expression ?
      > >
      > > I posted this question to other newsgroup, but I'm still hungry for it.
      > >
      > > I tried to change any numeric characters to Zero like following;
      > > $aaa = ereg_replace ("|0-9|", "0", $sentence);
      > > This seems working perfect.
      > >
      > > My question is how I can do this function only for outside of html tags.
      > > I don't want any numeric characters to be changed inside html tags.[/color]
      >
      > Give it a try - I didn't try it myself. :-)
      >
      > | $aaa = preg_replace("/((<[^>]*)|\d)/e", '"\2"=="\1"? "\1":"0"',[/color]
      $sentence);[color=blue]
      >
      > Regards,
      > Matthias[/color]


      Comment

      Working...