PHP Code Ignitor Library - Regex / Pattern Finder Class

I am the head PHP developer for a search engine marketing company. We are working on a PHP project and are looking to outsource some sections of the code.


PHP 5.3

Mysql/[url removed, login to view]

Apache/[url removed, login to view]



CodeIgnitor [url removed, login to view]


We need a Code Ignitor Library/Class built that will contain the functions listed below. The class will be named ST_Pattern_Finder. The function names, parameters, and purpose are listed below.

GUIDELINES: This must be coded as a CodeIgnitor Custom Library. Do not use any functions that are deprecated as of PHP 5.3. Where possible use Regular Expressions and the PHP preg functions to find patterns in the text. Most of these functions will pass in a large block of html text usually from a webpage and will return either a single string result or an array of results. Note that the $pattern parameter below will NOT contain a regex pattern. Your code must convert it into regex if neccessary. It will simply be a straight forward piece of text and may contain funny characters commonly seen in html code such as... < > / \ " ' ? + ..etc.... An example of a pattern being passed might be something like an html tag or half of an html tag or some random text...


// pass $text as a string and return all the text as a string found before $pattern

function extract_before($text,$pattern) { return $string; }

EXAMPLE: extract_before("Some text before.<h2>Results</h2>Some text after.","<h2>Results</h2>")

RESULT: Some text before.

// pass $text as a string and return all the text as a string found after $pattern

function extract_after($text,$pattern) { return $string; }

EXAMPLE: extract_after("Some text before.<h2>Results</h2>Some text after.","<h2>Results</h2>")

RESULT: Some text after.

// pass $text as a string and return all the text between 2 patterns

// Note: if multiple results found simply return the first one

function extract_between($text,$begin,$end) { return $string; }

EXAMPLE: extract_between("Some text before.<h2>Results are here</h2>Some text after.","<h2>","</h2>")

RESULT: Results are here

// pass $text as a string and return whether "any" of the patterns in the array were found inside it or not.

function check_pattern_any($text,$pattern_array) { return TRUE/FALSE; }


$array=array("before.<h2>","here</h2>","Not Here")

check_pattern_any("Some text before.<h2>Results are here</h2>Some text after.",$array)


// same as previous function but only return TRUE if "all" items from array are found in text

function check_pattern_all($text,$pattern_array) { return TRUE/FALSE; }

// same as previous function but only return TRUE if "no" items from array are found in text

function check_pattern_none($text,$pattern_array) { return TRUE/FALSE; }

// functions to extract url/links out of a large string of text...

$limit is the optional number of items to return.

If $limit is reached then stop and return array.

If $limit is ommitted then default to unlimited.

url = a full long url with page name and any querystrings attached.

domain = just the domain name OR with the subdomain if any like [url removed, login to view] or [url removed, login to view]

internal = any links that are relative or local to the $domain passed

external = any links that are NOT relative or local to the $domain passed...

function extract_url_array($text,$limit)

function extract_internal_url_array($text,$domain,$limit)

function extract_external_url_array($text,$domain,$limit)

function extract_domain_array($text,$limit)

function extract_external_domain_array($text,$domain,$limit)

function extract_email_array($text,$limit)

// function to check if there is an "href" link and text located in the text that matches the domain name passed, if so return the full href anchor link and the anchor text in between the <a href="anchor">anchor_text</a> tags. Return as an array including "anchor" and "anchor_text". If not found in text then return FALSE.

function extract_backlink($text,$domain)


$text='<a href="[url removed, login to view];var=2fsfaasd" >30" Things To Do</a><br>WD30EP Traditional Warming Drawer kitchen access';


RESULT: array("anchor"=>"[url removed, login to view];var=2fsfaasd","anchor_text"=>"30" Things To Do")

// stripping functions below... strip out characters out of the text and return what is remaining. Also include the function "trim" inside all of these functions to trim excess whitespace off the edges. Their will be an optional $chars string which can be passed that would include additional characters to strip. $chars would be passed like "$%^*"

function strip_chars($text,$chars) // strip out the single chars passed in $chars like "?><!@#$%"

function strip_htmltags($text,$chars) // strip all html opening and closing tags and attributes

function strip_htmltags_single($text,$tag_array) // strip all occurances of html tags named $tag(array of tags)

function strip_numeric($text,$chars) // strip out 0-9

function strip_nonascii($text,$chars) // strip out non ascii characters

function strip_alpha($text,$chars) // strip out A-z

function strip_alphanumeric($text,$chars) // strip out A-z and 0-9 and optional single chars

function strip_nonalphanumeric($text,$chars) // strip out everything except A-z and 0-9

Evner: Codeigniter, PHP

Se mere: codeigniter finder, codeigniter regex library, regex pattern finder, text pattern finder, regex library codeigniter, php pattern finder string, codeigniter regex strip, where to find php developer, what is search string, what is php developer, what is a search string, what can we outsource, what can i outsource, use regular expressions, true results, string pattern, string library in c, string library c, some search string, search string in array, search engine names, regular expressions in c, regular expressions example, regular expressions c, regex or pattern

Om arbejdsgiveren:
( 3 bedømmelser ) Scottsdale, United States

Projekt ID: #684140

Tildelt til:


Please check your PMB :)

$175 USD in 3 dage
(1 bedømmelse)

4 freelancere byder i gennemsnit $181 på dette job


Please check the pmb

$200 USD in 3 dage
(0 bedømmelser)

please check the PMB

$150 USD in 4 dage
(0 bedømmelser)

Hi, I am Mizanur Islam Laskar from Bangladesh, working as a web professional on PHP/MySQL for 7 years. Please checkout your PM to learn about my offers, portfolio, etc. Thanks.

$200 USD in 6 dage
(0 bedømmelser)