Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F79066113
TestRegex.java
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Aug 24, 14:09
Size
597 B
Mime Type
text/x-c
Expires
Mon, Aug 26, 14:09 (2 d)
Engine
blob
Format
Raw Data
Handle
20142907
Attached To
R2075 deconvolution
TestRegex.java
View Options
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
public
class
TestRegex
{
public
static
void
main
(
String
[]
args
)
{
// TODO Auto-generated method stub
String
c
=
"-image -image -- image image -image \t language -image"
;
String
regex
=
"\bimage\b"
;
Pattern
p
=
Pattern
.
compile
(
regex
);
// Check each entry of list to find the correct value
Matcher
matcher
=
p
.
matcher
(
c
);
while
(
matcher
.
find
())
{
System
.
out
.
print
(
"Start index: "
+
matcher
.
start
());
System
.
out
.
print
(
" End index: "
+
matcher
.
end
()
+
" "
);
System
.
out
.
println
(
matcher
.
group
());
}
}
}
Event Timeline
Log In to Comment