So, one line looks like this "Combined_Make = GRAND CHEROKEE LIMITED", Yet the regex returns 'Combined_Make = GRAND CHEROKEE LIMITEDNow what Im after in 'GRAND CHEROKEE LIMITED'Can anyone explain how to modify the regex to show me the text between 'Combined_Make = ' and 'Heres the culprit again! xmlhttp.responseText.match(/Combined_Make =(.*?)I hope thats all clear, thanks very much in advance!"> Any Java regular expression experts out there ? - Forums

Forums

Any Java regular expression experts out there ?

Mizpah 07 Sep, 2009
heya folks,

as per this thread: http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=2&t=15549&p=39105&hilit=mizpah#p39105 we now have a pretty complex form going on - and we are into one of the last parts, the ajax works,sql queries work, webservice works - and im still going insane with trying to get my php $variables over into Javascript!!

it seems the solution is to use regex to grab them from responceText as per (something like) this code snippet:

function stateChanged()
{
if (xmlhttp.readyState==4)
  {
  document.getElementById("test").innerHTML=xmlhttp.responseText;
  cmake = xmlhttp.responseText.match(/Combined_Make =(.*?)</);
alert (cmake);
}


xmlhttp.responceText contains this output:
//test output - confirms the the lookup is using the vrm correctly, and functioning!

echo "<span class=\"note\">";
echo "Test Output\n";
echo " Combined_Make = $model\n";
echo " Combined_Model = $marque\n";
echo " ModelYr = $year\n";
echo " ColourCurrent = $colour\n";
echo " CombinedEngineCapacity\n";
echo " CombinedFuelType\n";
echo "The vrm looked up = $q;
echo "</span>";
?>


So, one line looks like this "Combined_Make = GRAND CHEROKEE LIMITED<br />", Yet the regex returns 'Combined_Make = GRAND CHEROKEE LIMITED<,GRAND CHEROKEE LIMITED' when I use alert to examine the var.

Now what Im after in 'GRAND CHEROKEE LIMITED'

Can anyone explain how to modify the regex to show me the text between 'Combined_Make = ' and '<' only ? ultimately I need to return it to a var, and use it to change a field on the fly (for multiple fields/vars),
Heres the culprit again! xmlhttp.responseText.match(/Combined_Make =(.*?)</);

I hope thats all clear, thanks very much in advance!
This topic is locked and no more replies can be posted.