YuParse
Last updated
Last updated
YuParse is a lightweight and efficient ASCII/text parser designed for real-time data extraction on the edge. It is a core component of the YuDash Axon processing engine and is optimized for structured sensor output from industrial instruments such as weather stations, weighing scales, and transmitters.
YuParse uses a pattern-matching approach where users define a template string with token identifiers (like #D1
, #I2
, #T
, #A1
, etc.) to extract specific fields from continuous or formatted ASCII inputs. It is tolerant to inconsistent whitespace and supports both data capture and structural matching.
YuParse simplifies the challenge of parsing vendor-specific ASCII formats by providing a flexible yet deterministic framework that decouples pattern logic from parsing code. It enables high-throughput, low-overhead data structuring — critical for scalable IIoT deployments.
The values extracted by YuParse can be directly utilized in various downstream pipelines. Parsed fields can be published to MQTT or HTTP endpoints. Additionally, these values can be fed into YuDash’s built-in Modbus RS485 or TCP/IP server, enabling seamless SCADA or PLC integration. This makes YuDash a powerful edge converter — capable of translating vendor-specific ASCII outputs into json payloads or Modbus-readable registers.
Following are the steps to use YuParse Engine:
The reading of text data from RS485 (or RS232) port is handled as custom "Modbus" registers, as explained here. Refer to documentation of . The string is provided as input (inputVar) to YuParse engine which will be matched with "pattern" string.
This the pattern string which will be used to parse the inputVar.
YuParse matches the inputVar
(ASCII string) against the provided pattern
.
By default, whitespace is ignored during matching for both inputVar and pattern. Extra spaces, tabs, or inconsistent spacing do not affect parsing. For strict parsing of inputVar, there is an option (described later).
The pattern is composed of:
Tokens (e.g., #D1
, #A2
) used to capture values.
Tokens without a numeric index (e.g., #D
, #S
) are treated as match-only and not stored in the output.
Static strings (e.g., TEMP=
, RH=
, (Gross)
) that must match exactly
Matching is case-sensitive for static strings (TEMP
≠ temp
).
YuParse performs a best effort left-to-right match, allowing partial parsing when some fields are missing or invalid.
Parsing stops when:
The pattern is fully matched
Or the input string ends unexpectedly or mismatches
Pattern Element
Type
Stored?
Description
#D1, #D2
Decimal/Float
✅ Yes
Parsed as float
#I1, #I2
Integer
✅ Yes
Parsed as integer
#T1
Timestamp
✅ Yes
Epoch timestamp
#S1, #S2
String
✅ Yes
Any text until next whitespace
#A1, #A2
Alphanumeric
✅ Yes
Strictly alphanumeric (letters and digits only)
#Sx
String ending with fixed character
❌ No
Any text until a known character (x).
x may be mostly a "," or "=" etc.
#D, #S, #A
Match-only
❌ No
Used for pattern alignment; parsed but not stored
#N
New line
❌ No
Match a new line (\n) or carriage return (\r).
Non-token word
Literal Match
❌ No
Must exactly match input, ignoring extra whitespace
Input String (inputVar)
YuParse Pattern (pattern)
Parsed Values
TEMP=23.4 RH=65.2
TEMP=#D1 RH=#D2
D1=23.4
, D2=65.2
STATUS=(OK) VALUE=99.8
STATUS=(#A1) VALUE=#D1
A1=OK
, D1=99.8
Device=ABC TEMP=45.0 UNIT=C
Device=#A TEMP=#D1 UNIT=#S
D1=45.0
Device=ABC TEMP=45.0 UNIT=C
#S=#A1 TEMP=#D1 UNIT=#A2
A1=ABC, D1=45.0 A2=C
t=21.5 , humid=(64.2)%
t=#D1 , humid=(#D2)%
D1=21.5
, D2=64.2
(Gross) 125.67 kg (Tare) 5.00 kg
(Gross) #D1 kg (Tare) #D2 kg
D1=125.67
, D2=5.00
TEMP:23.4,HUMIDITY:55.6
TEMP:#D1,HUMIDITY:#D2
D1=23.4
, D2=55.6
S/N=SNX123 Value=7.89
S/N=#A1 Value=#D1
A1=SNX123
, D1=7.89
Sensor1=OK Pressure=102.56 mbar
Sensor1=#A1 Pressure=#D1 mbar
A1=OK
, D1=102.56
DATA: A23 B56 C99
DATA: #A1 #A2 #A3
A1=A23
, A2=B56
, A3=C99
WSpd=5.2 Dir=NW Temp=21.3
WSpd=#D Dir=#A1 Temp=#D2
A1=NW
, D2=21.3
After parsing the input string using the pattern, YuParse assigns values to temporary tags such as D1
, A2
, S1
, etc. These tags must then be mapped to user-defined variable names to make them meaningful and usable in further processing.
Mapping is defined using the tagArray
field in your configuration.
Each entry maps a token tag (e.g., "D1"
) to a custom variable name (e.g., "temperature"
).
These variable names are similar to other variables read by YuDash devices. They can be published to MQTT/HTTP or used in Modbus server (only for numeric numbers)
Axon must be explicitly enabled using "axon": 1
The axonSettings
block is ignored unless Axon is active
Axon is supported only on selected YuDash models
inputVar
string
Name of the input variable holding the ASCII string to be parsed. This is typically read through Modbus module.
pattern
string
YuParse-compatible pattern using tokens like #D1
, #A1
, etc. This will be matched with the inputVar.
tagArray
array
List of mappings between token tags and output variable names.
tagName
string
The token ID from the pattern (e.g., "D1"
, "A2"
, "T"
)
varName
string
Custom variable name to use in downstream logic, MQTT, Modbus, etc.
sensor_string
is assumed to be an ASCII input like:
The pattern
uses tokens #D1
and #D2
to extract two decimal numbers
These are mapped to final variable names temperature
and humidity
via tagArray
These variables can then be used in the payload.
By default, YuParse ignores all whitespace (spaces, tabs, etc.) in the input string when matching against a pattern.
To enable strict whitespace matching, set "whiteSpace": 1
inside a parseArray
block.
#W
Match any number of whitespace characters
Required only when whiteSpace
is 1
📌 Note: The #N
(newline) token can be used in both whitespace-sensitive and default modes. Newlines are not ignored, even when general whitespace is ignored.
Input String:
Input String:
🧾 Sample Input String:
YuParse supports parsing multiple input strings simultaneously, each potentially coming from different sensors or serial sources.
To enable this, the configuration uses a parseArray
array, where:
Each item in the array defines a separate parsing block
Each block specifies:
An inputVar
(input string source)
A pattern
to match
A tagArray
to map captured values to usable variable names
This design allows you to process multiple ASCII inputs in parallel, even if they come from different instruments or formats.
env1_string
:
env2_string
: