Sponsored Content
Top Forums Programming RegEx in Java. \b does not react to a newline Post 302420880 by machinogodzilla on Wednesday 12th of May 2010 08:11:09 PM
Old 05-12-2010
RegEx in Java. \b does not react to a newline

Hello,

In Java I use this regular expression \b\w+\b as a pattern in order to find words but the boundary does not react to newlines. For example, in the following text:

Code:
hello and bye

and

blah

it finds the words below:

hello
byeandblah
and

Could someone tell how to fix that?

p.s. Just in case it's a clue, the example text does not have empty lines when I view it in gedit, they only appear over here, after I paste the text and submit the post.
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting perl regex to sed regex

I am having trouble parsing rpm filenames in a shell script.. I found a snippet of perl code that will perform the task but I really don't have time to rewrite the entire script in perl. I cannot for the life of me convert this code into something sed-friendly: if ($rpm =~ /(*)-(*)-(*)\.(.*)/)... (1 Reply)
Discussion started by: suntzu
1 Replies

2. Shell Programming and Scripting

Modify or react on "cd" command

Hi folks, I found a pretty nice thread in this forum showing how to change the window title of a PuTTY window from within the shell. (Which I can't reference due having less than 5 postings?!?) I modified the solution a bit to have a function in my zshrc "wt()" changing the window title each... (8 Replies)
Discussion started by: mephistho
8 Replies

3. Shell Programming and Scripting

Add newline to regex

I have a perl script that runs a program and puts the output of the program into a variable. The output of the file looks like: Statistics 0 AverageTime: Statistics 0 AverageTime: I'm trying to run a regular express against this to pull out the first value in each of the parens... (1 Reply)
Discussion started by: Boomn4x4
1 Replies

4. Shell Programming and Scripting

Perl, RegEx - Help me to understand the regex!

I am not a big expert in regex and have just little understanding of that language. Could you help me to understand the regular Perl expression: ^(?!if\b|else\b|while\b|)(?:+?\s+){1,6}(+\s*)\(*\) *?(?:^*;?+){0,10}\{ ------ This is regex to select functions from a C/C++ source and defined in... (2 Replies)
Discussion started by: alex_5161
2 Replies

5. Shell Programming and Scripting

Sendmail K command regex: adding exclusion/negative lookahead to regex -a@MATCH

I'm trying to get some exclusions into our sendmail regular expression for the K command. The following configuration & regex works: LOCAL_CONFIG # Kcheckaddress regex -a@MATCH +<@+?\.++?\.(us|info|to|br|bid|cn|ru) LOCAL_RULESETS SLocal_check_mail # check address against various regex... (0 Replies)
Discussion started by: RobbieTheK
0 Replies

6. Web Development

Google Trends: react.js angular.js vue.js

While I'm on the subject of Google trends, here is a global trend since 2004 comparing react.js, angular.js, vue.js It's no secret I'm a vue.js fan and coder, but not because of the trend line (which I just saw for the first time a few minutes ago) My experience is that vue.js, a late arrival... (0 Replies)
Discussion started by: Neo
0 Replies

7. UNIX for Beginners Questions & Answers

Pass RegEx to java program in bash script

I can't seem to get this right. I've tried it every way imaginable using every trick I see on stackexchange and such. No luck. So nothing major here, something like: #!/bin/bash SEARCH="ARG1 ARG2 '((^EXACT$)|(.*InTheMiddle*)|(^AtBeginning*))'" java -cp /my/class/path MyClassName $SEARCH... (3 Replies)
Discussion started by: stonkers
3 Replies
GEDIT(1)						      General Commands Manual							  GEDIT(1)

NAME
gedit - text editor for the GNOME Desktop SYNOPSIS
gedit [OPTION]... [FILE]... DESCRIPTION
gedit is the official text editor of the GNOME desktop environment. While aiming at simplicity and ease of use, gedit is a powerful general purpose text editor. It can be used to create and edit all kinds of text files. gedit features a flexible plugin system which can be used to dynamically add new advanced features to gedit itself. OPTIONS
--help Prints the command line options. --encoding Set the character encoding to be used for opening the files listed on the command line". --new-window Create a new toplevel window in an existing instance of gedit. --new-document Create a new document in an existing instance of gedit. +[num] For the first file, go to the line specified by "num" (do not insert a space between the "+" sign and the number). If "num" is missing, go to the last line. filename(s)... Specifies the file to open when gedit starts. If this is not specified, gedit will load a blank file with an "Unsaved Document" label. Multiple files can be loaded if they are separated by spaces. gedit also supports handling of remote files. For example, you can pass the location of a webpage to gedit, like "http://www.gnome.org", or load a file from a FTP server, like "ftp://ftp.gnome.org/robots.txt". --list-encodings Display list of possible values for the encoding option and exit --version Output version information and exit BUGS
If you find a bug, please report it at http://bugzilla.gnome.org/enter_bug.cgi?product=gedit. AUTHORS
Paolo Maggi (paolo@gnome.org) Paolo Borelli (pborelli@katamail.com) James Willcox (jwillcox@gnome.org) Federico Mena Quintero (federico@novell.com) Chema Celorio 24 Apr 2006 GEDIT(1)
All times are GMT -4. The time now is 02:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy