| Author |
Regex to use in replaceall
|
Ram ank
Greenhorn
Joined: Apr 28, 2011
Posts: 10
|
|
Hi Guys
I want to add newline after occurence of IPV4 address in my string. I am trying with output.replaceAll("?<=(\\d{1,3}\\.){3}\\d{1,3}", "\n");
But it is throwing Exception. Please help me.
|
 |
Jeff Verdegan
Bartender
Joined: Jan 03, 2004
Posts: 3143
|
|
Ram ank wrote:But it is throwing Exception. Please help me.
You need to TellTheDetails(⇐click)
Copy/paste the exact, complete error message, as well as the line of code that caused it.
|
 |
Jeff Verdegan
Bartender
Joined: Jan 03, 2004
Posts: 3143
|
|
One thing jumps out at me though. As far as I know, you have to do
not just
|
 |
Ram ank
Greenhorn
Joined: Apr 28, 2011
Posts: 10
|
|
It worked like this
with ?<ip> it stores the matching string and using it in replacement with ${ip}
output.replaceAll("(?<ip>(\\d{1,3}\\.){3}\\d{1,3})", "${ip}\n");
Thank you guys
|
 |
 |
|
|
subject: Regex to use in replaceall
|
|
|