Jump to content

get numbers and alphabet using php

- - - - -

  • Please log in to reply
4 replies to this topic

#1
lol33d

lol33d

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
hi guys

i have a html code with more tables

this is code:
<table><tr><td width=10>x<td width=20 align=left>b</tr></table>

is this 3 table

my tables not have close tag(</td>)

i want get content only.

this is my php code for get
preg_match_all("/>(.*?)</si", $htmlcode, $matches);

but i need better code for get info

please help me

thank you

Edited by lol33d, 25 August 2011 - 10:54 AM.


#2
Vaielab

Vaielab

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 547 posts
I don't know much about regular expression so I won't be able to help you with this.
But if you only need the returned string and don't care if all the alphanumeric are in a single string, you can remove all the html tag with strip_tags

#3
lol33d

lol33d

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
if remove tags, result is closed :rolleyes:

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
How does this one work for you?
[COLOR=#000000][COLOR=#0000BB]preg_match_all[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"/td .*?>(.*?)</si"[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]$htmlcode[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]$matches[/COLOR][COLOR=#007700]);  [/COLOR][/COLOR]

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
lol33d

lol33d

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
thank you WingedPanther


that's right

its very nice




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users