Jump to content

Recommended Posts

Hi,

 

I am working on a SEO Keyword linking script and i need help fixing a bug in my regex pattern.

 

$keywordz = array("api integration salesforce integration","salesforce integration","api integration","web services");

 

Here is my pattern ($url can be any url):

for($i=0;$i<count($keywordz);$i++){

$pattern = '!(<[^a][^>]*>[^<]*)('.$keywordz[$i].')!i';

$replacement = '$1<a href="/'.$url.'">$2</a>';

$text = preg_replace($pattern, $replacement, $text);

}

 

Here is the text the pattern is having problems with:

<h1>Salesforce Integration and API Integration in New York</h1>

<p>Perpetual Technologies Unltd. specializes in api integration and Salesforce Integration in New York City. We have extensive experience in integrating CRM Systems with additional corporate data, utilizing web services APIs - working with SOAP and PHP. We can connect your "online work requests" to salesforce, automatically storing them in a database, and automatically generating and emailing "job tickets", listing all relevant project-related information. Salesforce Integration will help your company operate more smoothly.</p>

 

URL: http://perpetualtechnologies.net/salesforce-integration/api-integration.htm

 

The Problem:

The first occurrence of "Salesforce Integration" does not get hyperlinked..  :confused:

 

Can anyone help me out??

 

Thanks in advance,

 

Nik

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.