Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Minor Regex find and replace components not working as intended
#1
Finally made a forum account after all these years to make this recent discovered bug, a report, and yes, it’s one for the nerds. Flourish has also been advised of the bug prior to this thread being written. 

Problem:
Regex replace and find components do not function as intended. [Set Regex Replacement] does not work. Additionally both [Set Replacement] and [Set Flag] are not options when regex components are set by other components. 

How to replicate:
1. Link button to trigger two separate relay components and a delay component.
2. Set the button [Set Signal] to abcdef.
3. Set the Delay component to 20 (this avoids component buffer issues when a component receives multiple messages at one time).
4. Set relay 1 to [Signal changing ON], and [set signal] to 'c’. Set relay 2 to [Signal changing ON], and [set signal] ‘1’.
4. Wrench in a regex replace component. Set flag using a multitool to g. Connect relay 1 to ‘Set regex’. Connect relay 2 to ‘Set regex replacement’. Connect delay to ‘replace string’
5. Set regex replacement component to output to a sound synthesizer.
6. Press button.

Actual result: 
The sound synthesizer says ‘abcdef’.

Intended result: 
Regex replace component string set to: c/1/g and the sound synthesizer says ‘ab1def’. 

Fix:
Beneath are two examine texts of replace components after one was set using components, the other by multi-tool.

Set by component: 'This is RegEx Replace Component. Current Expression: c, Current Replacement: 1.' 
Set by multi-tool: 'This is RegEx Replace Component. Current Expression: c/1/g, Current Replacement: 1.'

Clearly the expression set by components is missing the replacement value and the flag. Both can be explained.

For the next test I started with two newly vended regex replace components which were both set using a multi-tool. When setting a regex replace component you have two replacement options:  
[Set Regular Expression Replacement]
[Set Replacement]

For the first regex replace component:  [Set Regular Expression Replacement] was set as 'a'. When examined it reads, 'This is RegEx Replace Component. Current Expression: original/replacement/g, Current Replacement: a'.

For the second regex replace component: [Set Replacement] was set as 'a'. When examined it reads, 'This is RegEx Replace Component. Current Expression: original/a/g, Current Replacement: a.'

Currently when a component is connected to a regex replace component it only has three options. [Replace String], [Set Regex], and [Set Regex Replacement]. The fix requires [Set Regex Replacement] to be changed to, or have [Set Replacement] added as an option. This will then allow components to set the replacement parameter. 

One further problem is present. There is no option to [Set Flag] on BOTH regex find and replace components. This needs to be added for multi-tool and components. Then components will be able to set the current expression of a regex replace component to pattern/replacement/flag. Likewise, regex find component expressions will be able be set as pattern/flag.

After all this, all nerds can rejoice in their newfound ability to automate regex replace components.


Messages In This Thread
Regex find and replace components not working as intended - by Wilbur Wright - 07-26-2018, 11:28 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)