Attempts to extract a property value from the input text. The following heuristics are used:
- It searches for the passed name (
propertyName) followed by an “assignment character” (space, colon or equal sign).
- Everything between the assignment character and an “end character” (comma, semicolon) or up to the end of the line is returned as the value of the property.
- If the property is not found,
fallbackis returned (or an empty text if
fallbackis not defined.
text = “Product properties: Color: red, Size: XL, Notes: do not spin.”
extractProperty(text, "size")→ “XL”
extractProperty(text, "Notes")→ “Do not spin”.