jEdit Community - Resources for users of the jEdit Text Editor
regular expression, on how to match cross lines
Submitted by zhangweiwu on Sunday, 31 January, 2010 - 10:56
Hello.

By default single dot "." in jEdit do not match line break. In effect it is pretty much the same as [^\n].

When I want to match across multiple lines, I often use [^韡], which matches \n just fine. e.g. the following matches everything between Section and EndSection, it can match a few hundreds lines just fine:

Section[^韡]*EndSection

This method is "invented" by me, because my name 韡 is a really rare character that hardly used anywere, and I just need an impossible character in [^] so that I can match across lines.

I write this post to ask what is the standard way to do so, than my home-brew method.
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
regular expression, on how to match cross lines
by michaelm on Mon, 01/02/2010 - 07:37
Hi,

Did you try :
(?s)(start).*(end)

This is the DOTALL mode

Michaël
 
interesting to see there is a
by zhangweiwu on Mon, 01/03/2010 - 02:50
interesting to see there is a dotall mode.

I looked up where this is referred to:

http://java.sun.com/docs/books/tutorial/essential/regex/pattern.html

Thanks.
User login
Browse archives
« August 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   95567
Context Free Art (*.cfdg)   0.31   46060
BBEdit scheme   1.0   18599
JBuilder scheme   .001   18500
ColdFusion scheme   1.0   18029
R Edit Mode - extensive version   0.1   17478
Advanced HTML edit mode   1.0   16211
Matlab Edit Mode   1.0   16073
jEdit XP icons   1.0   15234
XP icons for jEdit   1.1   14298