again Experts,
I am grateful to have gotten the help of Jason Sperske with the regex below:
$pattern = "/(\d{2})([ND]?)(\d*)(GG[\d]*)?/";
function format($matches) {
return $matches[1][0].(strlen($matches[2][0])>0?$matches[2][0]:" ").$matches[3][0].(strlen($matches[4][0])>0?" ".$matches[4][0]:"");
}
The regex helps format values entered for an ID field.
For instance, if a user enters 12343GG90494, the regex will insert 2 spaces before the GG thereby producing the following output 12343 GG90494.
This is just one example of how the regex formats user input.
This is important because users of our apps often don't put the 2 extra spaces and a result, their searches produce no results.
The regex above solves that problem for us.
My issue right now is to use the regex with the following sample query:
$tid = $_GET["tid"];
// Connect to SQL Server database
include("../connections/TDConnect.php");
$tsql = "SELECT * FROM TC(dtops.dbo.tSearch, Name, '\"$tid*\"')";
How do I use it with the input param called $tid?
Your assistance, as always, is greatly appreciated.