jEdit Community - Resources for users of the jEdit Text Editor
Why use gnu.regexp package for regular expressions?
Submitted by ramiojares on Friday, 27 February, 2004 - 14:29
All regular expressions in jEdit are using syntax very different from the syntax
JDK uses. Why not start using the JDK's regex package?
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
java.xml is done (maybe because of performance) incorrect
by Anonymous on Tue, 02/03/2004 - 11:49
The main rule in java mode makes \ as escape character for all rules. This is incorrect because \ should work as escape only inside String and character literals. Example: \/** does not start javadoc comment even though it obviously should. The same applies of course to \"foo" The escape should be removed from RULESET and literal SPANs should be defined as follows: " [^\\]" ' [^\\]' The problem with this is that SPAN_REGEXP treats only the begin sequence as regex. Also the HASH_CHAR attribute is put there for performance reasons. I have nothing against good performance but optimizations should be applied ONLY when they are possible and do NOT compromise correctness. Thus HASH_CHAR should be optional and used only if the regex starts with a specific character.
 
The previous comment did not come out correctly...
by ramiojares on Tue, 02/03/2004 - 11:54
.. because it contained XML tags.
It was supposed to have the following XML:
<SPAN_REGEXP HASH_CHAR=""" TYPE="LITERAL1" NO_LINE_BREAK="TRUE">
<BEGIN>"</BEGIN>
<END>[^\\]"</END>
</SPAN_REGEXP>
<SPAN_REGEXP HASH_CHAR="'" TYPE="LITERAL1" NO_LINE_BREAK="TRUE">
<BEGIN>'</BEGIN>
<END>[^\\]'</END>
</SPAN_REGEXP>

Let's hope this works.
TERMINATE rule is questionable
by Anonymous on Mon, 01/03/2004 - 13:15
I searched for existence of terminate rule in jEdit's mode files and found that it was used only in text mode to turn off parsing.

The help files say that it is used in patch mode which is not true and obviously should not be used if the intention is to highlight the whole lines.

Could someone give an example in what syntax could one use Terminate rule?
gnu.regexp does look good but...
by ramiojares on Sun, 29/02/2004 - 12:49
I had a good look at gnu.regexp package that jEdit uses for regex matching. It does seem like a good package. The customizability is better than in java.util.regex. But where java is little better is the documentation. In gnu.regexp one can tweak the syntax to one's liking but many of the variations are not explained. And definitions of different syntaxes one has to finally dig from the source.

This is exemplified with jEdit's syntax which was PERL5 syntax with character classes enabled and line separator set to \n.

What still puzzles me is that in jEdit documentation \< is said to match at the start of a word. But gnu.regexp documentation says this belongs only to Egrep syntax.
 
Look at perl docs
by Brad Mace on Mon, 01/03/2004 - 17:15
for info on PERL5 regular expressions
http://www.perldoc.com/perl5.6/pod/perlre.html
 
I went there and...
by ramiojares on Tue, 02/03/2004 - 07:13
...I brought a quote from there: "Backslashed metacharacters in Perl are alphanumeric, such as \b, \w, \n. Unlike some other regular expression languages, there are no backslashed symbols that aren't alphanumeric. So anything that looks like \\, \(, \), \<, \>, \{, or \} is always interpreted as a literal character, not a metacharacter." So this explicitly says that \< does not belong to PERL5 syntax right?
User login
Browse archives
« October 2024  
MoTuWeThFrSaSu
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   100936
Context Free Art (*.cfdg)   0.31   46062
BBEdit scheme   1.0   18601
JBuilder scheme   .001   18502
ColdFusion scheme   1.0   18031
R Edit Mode - extensive version   0.1   17481
Advanced HTML edit mode   1.0   16213
Matlab Edit Mode   1.0   16075
jEdit XP icons   1.0   15236
XP icons for jEdit   1.1   14300