.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Finding words not preceded by other words with MS Word wildcards

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :WPF

Can you help me construct a wildcard search pattern to find a word not preceded by another word to be used in MS Word 2010?

I need to match "likely" in the sentence 1) because it contains the word "likely" but not preceded by the word "not".

1) This is a test sentence containing likely there.

2) This is a test sentence containing not likely there.

Thanks a lot for your suggestions and cooperation!

View Complete Post

More Related Resource Links

I want to replace the exact words and not a part of word


I have created a table as below
CREATE TABLE [dbo].[EmpDetails](
[Name] [nvarchar](50) NULL,
[Address] [nvarchar](50) NULL,
[Town] [nvarchar](50) NULL,
[City] [nvarchar](50) NULL

I have inserted the value as below
INSERT INTO [Employee].[dbo].[EmpDetails] ([Name],[Address],[Town],[City])

I want the address as
5th Street

So I gave the update query as below
update empdetails
set address= replace(address,town,'')

But what happened was the address got modified as below
5th Street SHIRE.

Now when I give
update empdetails
set address= replace(address,city,''),
now such a word called as ARYSHIRE does not exist.

How do I sort this problem.

I want to replace the word ARY and not ARYSHIRE
This occurs in many parts of my table.

Kindly do let me know.

Parsing Words from Multiple Recordsets - Returning With Word Counts


I've had too many sleepless nights trying to work this out - I hope I can get some help here.

I have three distinct ADO recordsets that I need to parse words from and return to the client with sorted full word counts (less a predefined dictionary of innocuous words e.g. a, an, the, of.) across all three, references to the original record and references to the original source. The user needs to be able to drill in and out of this result set.

I'm going to simplify the layout for clarification purposes.

Let's say each data source has three identical fields 'updatedTime' (DateTime), 'text'(VARCHAR(255)) and 'ID'.

User goes to the site and searches for the word 'frog'.
User is returned with a word count of every record that has the word 'frog' in the 'text' field sorted by the top count down.
'green' 18 times in table A, 12 times in table B, 22 times in table C
'hop' 16 times in table A, 13 times in table B, 6 times in table C.
'roadkill' 12, 11, 4
'red' 10, 12, 3
And so on.

User clicks on the word 'green'.
Now only words with both 'frog' AND 'green' in the original record show up (again, with the counts and sorted by count).
A breadcrumb is built, so the user can click on 'frog' again to kill that filter.
User decides he doesn't want the default timeframe (6 months) and adjusts a filter

Programatically Find and Replace the words in Word documents in SP Doc library

The client has uploaded 1000 of MS Word document in SP Document Library.
We have to change some specific text in all documents which we upload in a Sp Document Library.
We have to do this without opening a document.(i.e) we have to do find and replace a text programatically.
Please provide me the solution.
Rajanikanth Rayala

Count words in the ascx file



I have 163 .resx files. I want to count the words in these files, because my want to translate the sentences (my task is the localisation).

Now I'm opening each file in Ms Visual Studio and I count words manually. How can I count words in all files? And the second question: can I use a program what grab strings from .resx into an editor where I can translate them and save bacn into .resx files? Or must open the files one by one and edit the text fields manually?

Thanks for helping, unfortunately I'm not a programmer.

Editor's Note: Under the Covers and Through the Words


There are some people who have little curiosity about the world around them. They drive to work without asking why their airbag light is on. They work all day, never once wondering why their computer goes through periods where it's slow as a snail.

Joshua Trupin

MSDN Magazine May 2005

search multiple words into textbox and populate all records in gridview related those keywords


I have a textbox and a gridview which is bound to a table

what I want to achieve is a solution where lets say there are two records - e.g. "1. Book and 2. Red", i want a user to type in those words and the gridview shows the results as followed;

1. Book

2. Red

I have set up the sql data source and everything and my like operator is this...

LIKE '%' + @record + '%'

how can I solve this problem?

SharePoint Workflow E-mail Hyperlink has the Spaces Between Two Words Are Removed

I have a very simple Workflow, that includes href link to Infopath form.
If the form name includes spaces, the URL redirects to a The Form has been Closed message, indicating that it cant find that form.
In our scenario, the file name of the document/form in SharePoint when saved is called "Travel Request - <submit date>"  as noted with spaces.
The Hyperlink URL in the email generated by the workflow appears to encode all values in the name after the first two words (after Request).  See below.  after the word Request the spaces are encoded properly.     its replacing the first space with it appears %0d%0a (CR LF)
The URL below is what is displayed when right clicking, and selecting Edit Hyperlink in the email

I can reproduce this in development and production.  Any ideas on how this can be resolved?

Replacing with multiple words

I have a string "The quick brown fox jumps over the lazy dog" and i want to replace a few words in the string. Like "The slow red fox climbs over the sleeping dog" I have setup a table called match with 2 fields [pattern], [Replace] with some data. quick slow brown red jumps climbs lazy sleeping How could i use the replace to achieve this? Thanks

REGEX does not match when line ends with the characters.. also, how to negate words that contain the

\S*(ai|ie)\S*   seems to match all words with characters ai and ie in them.  However it does not match if the line ends with them, how can fix that?Also, how can I match all words that DO NOT contain those characters.. I've tried ?! and [^ to no avail.Thanks in advance for any help or information!

How to find misspelled words with regex

Hi all I need a RegEx that will find a specific word within a long string. The issue is that this word may be misspelled and I need to find it even so. I would like to accept a certain percentage of wrong-ness when looking for the word. Ex. The complete string: Hello, this is my comp/et string to look at The word to search for: complete Let's say that I which to accept a maximum of two wrong letters in the above string, then the RegEx should match the word complete. However, if I only accept 1 wrong letter it shouldn't find it. Ideally the RegEx would also be able to handle whitespaces, and missing letters. Ex: The complete string: Hello, this is my com plee string to look at The word to search for: complete This should match the word as well, even though there is a whitespace between 'm' and 'p' and the letter 'l' is missing. Is this possible at all with RegEx or should I be looking at an alternative way to solve it? Thanks, Tommy

Code Camp 2010 in Words & Pictures

The Jacksonville Developer User Group pulled off an excellent code camp this weekend.  It was a great opprotunity to catch up with friends, meet new ones, and learn some good tech!  My day started off as a volunteer at the registration table.  We had a great group of volunteers...even if it was 6:30 in the morning...on a Saturday! Our welcome sign...who says you don't need a code monkey? After handing out badges, bags, and shirts for a couple hours it was off to my first class: SQL Server Complex Event Processing.  This is the new StreamInsight technology that is part of SQL Server 2008 R2.  Interesting stuff for streaming real-time data from various system...I'll need to dig into it a bit deeper. Next it was off to learn about Functional Programming and then "Becoming a Rx Pusher with the Reactive Framework".  The Reactive Framework talk was probably the most interesting of the day.  It was presented by Jim Wooley who posts at ThinqLinq.com.  The Rx framework looks extremely interesting in terms of how it handles asynchronous processing. Of course, I had to visit my friends over at PR'UF.  The PR'UF system was launched at this year's Code Camp and provides a better way to find the talented developers & architects you need.  What makes PR'UF different?  It uses reputable industry experts who

Find text between two separate words - to parse text from a message

Hi all, I am new to regular expressions.   The following text has got three sections; - Name, Date, and Message   [Sender]: John Smith  [Received]: 2005-8-21 3:28:9Hi bob, thanks for the message[Sender]: Paul Stein  [Received]: 2005-8-21 3:17:38Cannot make that time...[Sender]: Sarah S  [Received]: 2005-8-20 15:18:2No way! Let me know if it's on. I would love to see that film. It got great reviews.[Sender]: John Smith  [Received]: 2005-8-21 3:28:9Hi bob, thanks for the message[Sender]: Paul Stein  [Received]: 2005-8-21 3:17:38Cannot make that time...[Sender]: Sarah S  [Received]: 2005-8-20 15:18:2No way! Let me know if it's on.   I want to extract each of them.   The text between "[Sender]:" and  "[Received]:" is the NAME   The next word after the  "[Received]:"  is the DATE   The MESSAGE starts after the digits of the Date end and it is upto the mark  "[Sender]:"   Can anyone tell me how to extract it using C# Regular expressions.   Thank you for your time.   Tomy

Don't Get Me Started: Weasel Words

Euphemisms are the refuge of cowards.David PlattMSDN Magazine September 2010

Remove japnese / russian words in a String

Hi, I"m currently writing a ASP.NET MVC application in which I search twitter for new tweets. When however I use the language filter I still get some messages in japanese or russian. I tried using a Regular expression: [^\x20-\x7E\wáéíóäëiöúàêèììçù… ] which should tell me when a string contains japanese/NON ASCII characters. At least that's the output I get when I try checking this regex with a JavaScript function. This is my code: ----------- Regex languagesReg = new Regex(@"[^\x20-\x7E\wáéíóäëiöúàêèììçù… ]"); lstEntries.RemoveAll(e => languagesReg.IsMatch(e.Content)); -----------           Does anyone know why I get the right output with JavaScript functions and the wrong output in .NET? Or maybe someone might be able to help me find an other workaround? Thanks in advance Kasper

Negate predefined words using Regular Expression Validator

Hi Any one please tell a regular expression which allow all, except some predefined words. For example user should add their imaginary planet names to text field. So if he typed the existing planet names regular field validation don't allow further. i tried [^({Mercury})|({Venus})|({Earth})|({Mars})|({Jupiter})|({Saturn})|({Uranus})|({Neptune})|({Ceres})|({Ploto})|({Haumea})|({Makemake})|({Eris})] but not working. Its not working for any strings. Please tell me the correct way to do this One more thing i want to know is how lengthy expression can be given to the Regular Expression Validator. Thanks Akeeq

Enabling Enterprise Key Words for a custom list template

Hi, I have developed a list template in the usual manner, using features that create site columns, content types and then a list template that leverage's the content type.  I have a problem with Enterprise Keywords.  As this is simply a Yes/No type activation, I take it this column is slightly different from normal site columns.  When I first extracted my list template from a site with keywords activated, all I can see is that the keywords column has been added to the columns in the template.  There doesn't seem to be any setting that indicates that Managed Keywords is activated.  Regardless, I can create list instances from my template fine and the managed keywords column appears as expected.  The strange behaviour is that when I upload a new document and enter keywords for it, although these keywords are entered into the termstore, when I next view the document properties, the entries have dissapeared.  Is there something I need to do through code for this.  My problem is, as I want this setting to be enabled for a list template, How else do I activate the setting considering I cannot run code from a list template?  I hope someone can help, Cheers,   Amit

Amount in Words

Guys, I have a problem. I have a textbox where i enter the amount and in another textbox the amount in words comes automatically. The function appended below works fine when the amount entered is without a decimal. But if the amount entered has a decimal, then the function gives an error. Can anyone check the same and tel me a solution. Wat i want is suppose the amount entered in 2345.68 the amount in words should come, Rupees two thousand three hundred forty fve and sixty eight paisa only. if the decimal is not entered then the function gives proper result. public string IntegerToWords(double inputNum) { int dig1, dig2, dig3, level = 0, lasttwo, threeDigits; string retval = ""; string x = ""; string[] ones ={ "", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen" }; string[] tens ={ "", "Ten&qu
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend