preg_match_all total newbie

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default Re: preg_match_all total newbie

    On 2004-01-08, Something <*****@*****.***> wrote:
    > Just learning PHP (4.3.4). I seem to understand most. But one little
    > problem I couldn't figure out:
    > I need to be able to take a string (as 'Smith, Charly') and run it
    > through some sort of filter that only lets through the letters so
    > 'SmightCharly' is returned. I have tried my luck with some of the grep
    > functions but am totally unsuccessful. If nothing else I could write a
    > little function to do this but there's gotta be a better way.
    Define "better"?

    Just remove all characters that are not in the interval [a-zA-Z].
    str_replace will do just fine.

    --
    [url]http://home.mysth.be/~timvw[/url]
    Tim Van Wassenhove Guest

  2. Similar Questions and Discussions

    1. Total newbie--please be patient
      I've tried several flavors of Linux and finally settled on Ubuntu--received my CDs the other day. Trouble is, whenever I try to set up a dual boot...
    2. Total Newbie Needs Help
      How is your database setup?
    3. Newbie - Sum the total
      I am using Accss not SQL. ProductA sold 2 sets yesterday and 1 set today, Product B sold 3 sets yesterday and 2 sets today. By using "while not...
    4. Total newbie to this!
      Hi, I'm trying to crop up an image for a forum and the crop option doesn't do it as I want it to so I tried cutting, pasting and moving the parts I...
    5. Total newbie: ASP.NET or Coldfusion ?
      If you look at the difference in terms of power, ASP.Net is simply the most powerful web application platform ever to be created. It also is...
  3. #2

    Default Re: preg_match_all total newbie

    To remove non-alphanumeric characters:

    $sFiltered = eregi_replace("[^a-z0-9]", "", $sString);

    Where $sString contains "Smith, Charly", the statement would return
    $sFiltered contains "SmithCharly". [^...] implies character class "not"
    containing specific characters.

    Hope it helps. :-]

    Bryan

    "Something" <*****@*****.***> wrote in message
    news:*****-1533D1.01534708012004@news.indiana.edu...
    > Just learning PHP (4.3.4). I seem to understand most. But one little
    > problem I couldn't figure out:
    > I need to be able to take a string (as 'Smith, Charly') and run it
    > through some sort of filter that only lets through the letters so
    > 'SmightCharly' is returned. I have tried my luck with some of the grep
    > functions but am totally unsuccessful. If nothing else I could write a
    > little function to do this but there's gotta be a better way.
    >
    > Any suggestions welcome.
    >
    > Peter
    >
    > --
    > [url]www.acmerecords.com/oddgitjazz.html[/url]

    Bryan Chan Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139