Filter the barcode scanner input data and bind the newest barcode to a component

Hi all,
I have the following barcode data: Shift01093165040877083075]Control10MShiftFShift00001416]Control912124682
How can I set up the barcode input component that only takes the MF00001416, and bind/replace the newest barcode to text area.
I've tried to use the property binding, but the data set is array so it stores everything in the area.

Within the Barcode Scanned (Session) Event, I would use a regex to parse out only the information you want from the incoming value and then write that to a session property or tag, depending on if this data is relevant to only a session or anyone using the project. Then, I'd bind the display value against that session property.

import re
session.custom.barcode = re.search(regular_expression_here, data.text)


Am I doing it right? Because I;m still seeing this:
image

You can use a site like regex101.com to test your regexes:
Link for your case: regex101: build, test, and debug regex

def onBarcodeDataReceived(session, data, context):
	import re
	
	result = re.search(r'(Control.*?\b)', textIn)
	
	if 'groups' in dir(result):
		session.custom.barcode = result.group(0)
	else:
		session.custom.barcode = 'Not Found!'

Test:

import re
textIn = 'Shift01093165040877083075]Control10MShiftFShift00001416]Control912124682'

search = re.search(r'(Control.*?\b)', textIn)

if 'groups' in dir(search):
	print search.group(0)
else:
	print 'Not found!'

Output:

Control10MShiftFShift00001416
2 Likes