I am trying to come up with a regex to match the account name from a content. I have been trying this since yesterday with not complete success. Any help is greatly appreciated.
Following is the content against which comparison is made:
******************************************************
<select name="ctl00$ctl00$MainContent$ContentPlaceHolder2$Calendar3$ddlMonth" id="ctl00_ctl00_MainContent_ContentPlaceHolder2_Calendar3_ddlMonth" class="AANameDropDownBox">
<option value="January">January</option>
.......
<select size="4" name="ctl00$ctl00$MainContent$ContentPlaceHolder2$ListBoxAllAcct" multiple="multiple" id="ctl00_ctl00_MainContent_ContentPlaceHolder2_ListBoxAllAcct" class="AAFlDwldText">
<option value="114|11470000013|MOUNT CARMEL TR">11470000013 - MOUNT CARMEL TR</option>
******************************************************
Here I need to retrieve the value 114|11470000013|MOUNT CARMEL TR
I the regex I initially tried is: <option value="(\w+|\w+|[^"]*)">
This regex is able to retrieve the desired value when tried from a test class. But in the actual scenario as above, the value January is returned. Looks like it is matching the sequence well before the Account value is reached.
But I am surprised as to how it is ignoring the PIPE '|' symbol used in the regex, which is clearly missing in the value 'January'.
Please let me know if you need any clarifications.
Thanks,
Raghu
Following is the content against which comparison is made:
******************************************************
<select name="ctl00$ctl00$MainContent$ContentPlaceHolder2$Calendar3$ddlMonth" id="ctl00_ctl00_MainContent_ContentPlaceHolder2_Calendar3_ddlMonth" class="AANameDropDownBox">
<option value="January">January</option>
.......
<select size="4" name="ctl00$ctl00$MainContent$ContentPlaceHolder2$ListBoxAllAcct" multiple="multiple" id="ctl00_ctl00_MainContent_ContentPlaceHolder2_ListBoxAllAcct" class="AAFlDwldText">
<option value="114|11470000013|MOUNT CARMEL TR">11470000013 - MOUNT CARMEL TR</option>
******************************************************
Here I need to retrieve the value 114|11470000013|MOUNT CARMEL TR
I the regex I initially tried is: <option value="(\w+|\w+|[^"]*)">
This regex is able to retrieve the desired value when tried from a test class. But in the actual scenario as above, the value January is returned. Looks like it is matching the sequence well before the Account value is reached.
But I am surprised as to how it is ignoring the PIPE '|' symbol used in the regex, which is clearly missing in the value 'January'.
Please let me know if you need any clarifications.
Thanks,
Raghu