Is here any code to download information & words from different website?
Like Regex in VB.NET?
Printable View
Is here any code to download information & words from different website?
Like Regex in VB.NET?
Yes. PHP has a regular expression matching system. Lookup the function preg_match on the PHP homepage for example.
Thanks for information i tried it, but i don't understand it, because 99% what i found was for e-mail.
Can you give one example for some website?
Thanks.
the preg_match() function in the PHP manual does not have anything about email. I'm not sure what you were looking at, but surely you were not looking in the manual (as was suggested).
either way, the regular expression engine in PHP uses PCRE (Perl Compatible Regular Expressions), and you can learn more about them here. they really have little to do with any language and might even be considered a language of their own. I'd suggest playing around with them on test files/test strings to get the hang of it before trying to efficiently parse an entire website.
however -- regular expressions have nothing to do with what you were asking for in your original post ("download information and words from a different website"). the preg_match() function can help you parse strings, but it cannot "download information." you would need to use another function to fetch information. you could use the standard file opening functions (fopen() or file_get_contents()) as long as the allow_url_fopen directive is enabled in your PHP install, or you could opt for an extension such as cURL. once you've fetched the data, you can use preg_match() to parse it using a regular expression.
As kows has said. You would first need to read the contents of the website. Then the regexp you would you depended on what you would like to extract from the web page. Can you be more specific as to what you are looking to extract?
Can any one tell me what will be the regular expression for EmailID. If we are using Mobile Number field then what type of variable we should take for to save mobile number.
... this.. has nothing to do with regular expressions?
a mobile number would be a string; you want to probably store spaces and possibly parenthesis for an area code rather than having a long integer.