More interactive highlights for the "Test string" window
thanks for your great tool, i use this in recent time more and more :)
So, what's the problem: I used a very long the tester from myregexp.com (Java version: http://myregexp.com/signedJar.html) and i like that there are highlights found words to selected part of the expression.
See short illustration ("sln" fragment for example)
how about this ? I know it's similar with "MATCH INFORMATION" window or hints when hover, but... for more useful :) http://regex101.com/r/yB7xB1/1
Samples:



This is doable to some extent, but what should happen when you have several match groups in the search string? Should they all highlight? Should it be up to the user to scroll the test area to see what gets highlighted?
I will look into more intensive highlightning.
all! what's included in the selected group by text cursor. We need to go in depth .. and see only the total capture for simple seeing what's captured with selected block as in video
and yes, i think this can be a problem for such as recursion, balancing etc. http://www.regular-expressions.info/refrecurse.html
However, currently need to only simple equivalent as in old RegexUtil seems sources now placed here
forgot., the non-captured words also need i.e. selecting words outside groups - short illustration (words.mkv ~50Kb)
The site is terribly broken in my browsers, but I get the idea I guess. I can't replicate anything though. What should happen when you highlight say \w? It feels like this is going to be something quite hard to do efficiently and robust.
regex-util contains many problem (used version released in ~2008-2009!)
\w illustration (w_&_w+.mkv ~82Kb)
you trying with Java version ? on http://myregexp.com/signedJar.html ?
"Online regex tester" on myregexp.com i don't know what is it :) also not work... i use com.ess.regexutil_1.2.4.jar - http://sourceforge.net/projects/regex-util/files/regex-util/1.2.4/
I was trying the web version.
This is much easier to do in java, and much more efficient. I can probably make it highlight the matched GROUP when you highlight it in the regex, but not individual tokens I don't think.
I will fiddle with it this weekend.
I will fiddle with it this weekend.
cool, thanks :)
This is much easier to do in java
there shouldn't be difference
and much more efficient.
may be
I can probably make it highlight the matched GROUP when you highlight it in the regex, but not individual tokens I don't think.
it's simple or equivalent ;)
With sources RegexUtil I see the following:
in SecondaryEditorHilighter we have the next simple highlighting:
String regex = parsedRegex.getRegex();
...
List<ITextItem> list = parsedRegex.getList();
see ParsedRegex
com.ess.regexutil.parsedtext.ITextItem
public interface ITextItem
{
...
void highlight(StyleData sd, int caret);
int getIndex();
int getLength();
int getEnd();
...
with next step, we compile pattern:
pattern = Pattern.compile(res.toString(), parsedRegex.getFlags());
and the final operation:
Matcher m = pattern.matcher(text);
...
int i = 0;
while (m.find()) {
...
if (highLightingGroup != -1 && m.group(highLightingGroup) != null) {
selectionStyle.apply(sd, m.start(highLightingGroup), m.end(highLightingGroup));
// ^^^^^^
}
applying with ITextStyle
see implemented apply(StyleData sd, int start, int end)
if (foreground != null)
Arrays.fill(sd.foreground, start, end, foreground.intValue());
if (background != null)
Arrays.fill(sd.background, start, end, background.intValue());
and.. that's all..
another interesting:

community can't access to sources regex101.com, if I understand correctly. Right ?
While I havent implemented this entirely, I have implemented #146 -- kind of a step in the right direction.