Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RE: Noobs Guide to Regex
06-27-2004, 04:48 AM
Post: #1
RE: Noobs Guide to Regex
Thinking outside of the box (Icon_rotate) is handy when designing regex patterns such as matching characters that you don't want in a string rather than all the possibilities of characters that you want to allow.

Post your tips ...
Find all posts by this user
Quote this message in a reply
12-24-2009, 10:15 AM
Post: #2
RE: Noobs Guide to Regex
Regex uses pattern recognition applied to a string to output matches for us to use in our code. This can be a one-time match or many to produce an array of results.

Software for Internet Marketers and Webmasters
Find all posts by this user
Quote this message in a reply
01-30-2010, 08:53 PM
Post: #3
RE: Noobs Guide to Regex
The cool thing about regex is that you can extract data from text content that matches a pattern i.e. not an exact match. So this is great for data mining. For example I have a post here about how to extract lottery numbers from the results page. To do this you have to use regex since the numbers will be different in each draw, but the pattern of the web page HTML will remain the same.
Find all posts by this user
Quote this message in a reply
02-05-2010, 12:19 AM
Post: #4
RE: Noobs Guide to Regex
I was looking into ways to rewrite subdirectory to subdomain with .htaccess. Not may people will want to do this but I was looking for a way to do it anyway.

Here is the .htaccess code that I came up with:

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} domain.com
RewriteCond %{REQUEST_URI} ^/sub/(.*)/(.*)$
RewriteRule .* index.php?r=%1 [L]

So this causes the root domain requests that contain /sub/ to access index.php with the query string of r=YourSubdirectory

So in your index.php code you can use $_GET to get the referring site ID.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: