SUGGESTIONS AND ISSUES RELATED TO REGEX

Forum for TextAloud version 3

Moderator: Jim Bretti

Post Reply
Slyths
Posts: 22
Joined: Thu Apr 10, 2014 6:09 am
Contact:

SUGGESTIONS AND ISSUES RELATED TO REGEX

Post by Slyths »

Hello, everyone
I have some issues and suggestions for TA:

SUGGESTIONS
1. There should be a feature for showing the particular regex or any tweak acting on a text when a mouse is hovered over it.
For example, if I create a regex to skip "come", I suggest that there should be a feature to show up the regex when I hover mouse over the word "come". This will help in knowing which regex to delete or change in case it messes up my dictionary or preventing a particular regex to work, because it already preceded something I may want.

2. A feature to show a particular regex that crashes and prevents TA from proceeding further. Many a times, I have issues where there is an error in my regex that I am directed to the homepage of Nextup but I can't pinpoint what the problem is in TA. I waste a valuable time that I feel I should be saving trying to figure where the problem is.

3. In creating text to file: creating a media file in which the text actually flows as the sound is played, and not a static text while the sound advances.

ISSUE
1. I have difficulty in creating a regex that captures a particular string repeatedly in a line. Say for a example, I want a particular voice, named A, to capture any lne in between "^" and "^". However, in that particular string, there is also another string between "(" and ")" being captured by another specified voice, named B. This is addition to the fact that I have a default voice which is neither the voice A nor the voice B. I created a regex as such:

(?m)^(\^)(\s*)([A-Z\d,/\-\.\s’']+)(\([a-z,\d\s-]+\))*([A-Z\d,/\-\s’']+)*(\^)
<voice required="name = A">$3<voice required="name = B">$4<voice required="A">$5</voice></voice></voice>

Everything is fine above, whenever a line begining with "^" is encountered, voice "A" kicks in, and when "(" is encountered, voice "B" kicks in. Even when there is no "(", the regex is fine, as capturing "(" is optional as you can see. But that is only when parentheses occur only once in a text. Whenever there are multiple instances of parentheses, the regex no longer matches. Another option is to analyse the number of such occurances and apply my voice of interests but the issue is I can't predict the pattern of occurances or the number of the occurances. What I want is a regex that can cupture every instance of \([a-z,\d\s-]+\) several times, irrespective of number and location, within the line beginning and ending with "^", even when they are not close together but distance by a text that voice A interrupts. For example,

(?m)^(\^)(\s*)([A-Z\d,/\-\.\s’']+)(\([a-z,\d\s-]+\))*([A-Z\d,/\-\s’']+)*(\^), works fine
(?m)^(\^)(\s*)([A-Z\d,/\-\.\s’']+)(\([a-z,\d\s-]+\))*([A-Z\d,/\-\s’']+)* (\([a-z,\d\s-]+\))*([A-Z\d,/\-\s’']+)*(\^)
(?m)^(\^)(\s*)([A-Z\d,/\-\.\s’']+)(\([a-z,\d\s-]+\))*([A-Z\d,/\-\s’']+)*(\^) (\([a-z,\d\s-]+\))*([A-Z\d,/\-\s’']+)* (\([a-z,\d\s-]+\))*([A-Z\d,/\-\s’']+)*(\^)
the last two lines no longer match. Is there something that I can apply to the regex without altering my respell?
Post Reply