If we're dealing with just line-based data as you show it could be as easy as:
.*itemCode=([0-9]+).*
Which is brutal but would do the work. You'd extract the first matching group.
Although your example seems inconsistent and truncated, so this may vary. Please provide more details if there are other conditions.
Example
>>> import re
>>> oneline = "salespackquantity=1&itemCode=3760041\",\"quantity_box_sales_uom\""
>>> match = re.search('.*itemCode=([0-9]+).*', oneline)
>>> match.group(0)
'salespackquantity=1&itemCode=3760041","quantity_box_sales_uom"'
>>> match.group(1)
'3760041'
Do you really need regex?
Arguably, a regex seems an easy way to get what you want here, but it might be grossly inefficient, depending on your use case and input data.
Several other strategies might be easier:
- remove unnecessary data first,
- use a proper parser for your specific content (here this looks like a mix of a CSV and URL query strings),
- don't even bother and cut on appropriate boundaries, if the format is fixed.
Regex are powerful, and can be overly powerful for simple scenarios. Totally fair if it's to run a one-off data extraction script, though, or if the cost/benefit analysis of the development effort is worth it.