Regex to get middle of a string with known character boundaries
Hi, can I use a regex in tMap to get only what's in the
.* portion of this string?
(<br>Specific Text: ).*(</br>)
If not, what's the best way to go about this?
Thank You
Hi, using this in a tMap I am attempting the following:
RegexUtil.extractByRegexGroup(MyTable.MyField,"<br>Purchase Timeframe: (.*)</br>",1)
But nothing is coming through into the table
Could you please check one of your datasets with a regex test tool ? As you see in my picture the regex works. This routine works in my projects for a couple of years and I am absolute sure the problem are your data or your job.
Ok I have had partial success, but a good portion of the rows are being rejected due to a Data Truncation error.
Again here is my tMap expression:
RegexUtil.extractByRegexGroup(tablename.fieldname,"<br>Purchase Timeframe: (.*)<br>",1)
From what I can see it looks like for the ones that are making it through properly are the ones in which the Purchase Timeframe value is actually the end of the field.
So for example, a field like this:
".....contentcontentcontent.... <br>Purchase Timeframe: One Month<br>"
Gets through and appears perfectly in the target table as:
One Month
But a field like this:
".....contentcontentcontent.... <br>Purchase Timeframe: One Week<br>Will Finance Purchase: Yes<br>I Have a Trade-in: No<br>"
Fails and my tLogRow rejects output looks like this for the row:
One Week<br>Will Finance Purchase: Yes<br>I Have a Trade-in: No||||Data truncation: Data too long for column 'BuyBy' at row 1 - Line: 290
The fact that it's the end of the field for the ones that made it through is the only difference I can perceive so far
I will keep looking to see if I can find any other difference
Thank You
I think I have some valid results by adding a ? to the regex:
RegexUtil.extractByRegexGroup(tablename.fieldname,"<br>Purchase Timeframe: (.*?)<br>",1)
I am now no longer getting any Data Truncation errors