473,395 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Finding repeating words in a string by Regular Expression

Hi,

I want to find repeating words in a long string with Regular Expressions. I tried to write a regular expression but it didn't work.

"\b(?<word>\w+)\s+(\k<word>)\b"

This RegEx finds repeating words only if they are in consecutive orderçç

I need a regular expression pattern that finds repeating words even if they are not consecutive. I'm new with ASP.Net.

Please help me..

Thanks...
Jul 31 '07 #1
3 6879
jhardman
3,406 Expert 2GB
Hi,

I want to find repeating words in a long string with Regular Expressions. I tried to write a regular expression but it didn't work.

"\b(?<word>\w+)\s+(\k<word>)\b"

This RegEx finds repeating words only if they are in consecutive orderçç

I need a regular expression pattern that finds repeating words even if they are not consecutive. I'm new with ASP.Net.

Please help me..

Thanks...
moved to .NET forum. By the way, what language is this?

Jared
Aug 2 '07 #2
moved to .NET forum. By the way, what language is this?

Jared
Sorry,

I am using ASP.NET with C#.
Aug 3 '07 #3
Mikuam
1
This should work:

Expand|Select|Wrap|Line Numbers
  1. Match result2 = Regex.Match(inputText, @"(?<char>\s\w+)\k<char>\b");
Or find out more here:
http://fidevisionteam.wordpress.com/...pression-in-c/
Apr 17 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: lawrence | last post by:
"Garp" <garp7@no7.blueyonder.co.uk> wrote in message news:<_vpuc.1424$j_3.13346038@news-text.cableinet.net>... > "lawrence" <lkrubner@geocities.com> wrote in message >...
1
by: Tristan | last post by:
Im trying to expand a search util by uing regular expression to allow common search criteria such as +-* and phrases "". My understanding of ereg(string pattern, string string, ) is that the...
1
by: Sudhakar Doddi | last post by:
Greetings, I am a novice in Javascript and I am not able to succeed finding right regular expression for my requirement. Input in HTML form should be in the format of row.rack.bin i.e three...
3
by: greenflame | last post by:
I am trying to find a regular expression that returns true in the following cases but no others. 2.0 2.4 2. 324.0e345 234e34 34.e-43 234.673
0
by: leeonions | last post by:
Hi there, i am trying to use regular expressions to search through a text string and replace a given whole word. take the string = "The matsat on the mat!" (bad example i know) i want to...
2
by: leeonions | last post by:
Hi there, i am trying to use regular expressions to search through a text string and replace a given whole word. take the string = "The matsat on the mat!" (bad example i know) i want to...
3
by: RockyDev | last post by:
Hi All, I need a regular expression wherein i can find out phrases between double quotes. eg. string: this is sentence where i want "these words out" and also "some more words" out So...
6
by: Jack | last post by:
Hi there, Given a standard .NET string, does anyone know what the regular expression would be to locate each (optional) formatting item in the string (or more likely does anyone have a link that...
8
by: Avi | last post by:
Hi all, I'm using string Replace(string oldValue, string newValue) and would like it to replace only full words that matches oldValue and not when oldValue is a substring of a larger word. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.