How To Make Text Spinner Using RegEx

Aug 28, 2011

I am trying to make a text spinner using regex. The format of the text that will be spun it {Hi|Hello|Hey there} my name is {Bob|Max|Robert}.

Some possible outputs:
Hello my name is Robert.
Hey there my name is Bob.
Hi my name is Bob.

I found some code but can't get to it to work:
Imports System.Text.RegularExpressions
Public Class Form1
Function Spin(ByRef value As String) As String
' Invoke the Regex.Replace function.
[Code] .....
Link: [URL]

View 4 Replies


ADVERTISEMENT

Make Own Article Spinner?

Aug 21, 2009

i am new to programming but love to learn new things. I decided to jump in head first and write my own program on a whim one day. I've learned what I have so far through both books and online forums and help files.One thing I can't really seem to figure out, though, is how to implement a feature into my program.

I don't know if any of you will know what I'm talking about when I say that thing I want to program is my own article spinner. I've used them before, but all of the ones I have used require me to be online. I want to design my own for offline use.

The basics are this: You write an article in a textbox. Once you have that done, you go back and rewrite various words and phrases within the article using a format like this: {word1|word2} and {phrase one|phrase 2} and so on. Click a button and it saves your article to any number of text files using your unchanged words and phrases while also choosing just one of your words and phrases within the braces and between the bars.

[Code]...

View 2 Replies

Regex: Take Text & Some Special Characters Between The Xml Tags Using Regex On C#.net?

Feb 23, 2012

I want to take the text and some special characters between the xml tags.. My input file contains:

[Code]...

now i want the Regex to take text and the special characters between the tags <line>,<inline>..

View 2 Replies

How To Use DomainUpDown As Spinner To Control Values

Apr 11, 2010

I want to control domainUpDown as spinner to control value from 0 to 800 so that if i hit its upper arrow it adds 1 into current value...

View 1 Replies

Make A Simple Regex Pattern?

May 24, 2012

I have to validate a string using a regex pattern, I just can not figure out how to actually create it. In practice my string is composed of:

aw4d13-m12k4s It therefore can only contain characters from "a-z" and "0-9" separated by a "-" Who can kindly do it for me?

View 3 Replies

Make A Regex That Can Detect A Certain Character String

Dec 1, 2010

How do I make a regex that can detect a certain character string that is either all by its self in a line, or separated by white space.

If I have the line:

"ot"

Or the line

"sdf gdfg dv ewrsef fvdf ot sdfsd sdot"

I want to be able to detect the 'ot', except for the one that is 'sdot'

View 5 Replies

.net - Get The First Match From Text Using Regex?

Dec 13, 2011

I have a RegEx I am using in vb.net and i can get all the matches of the text but i want to get the first match of the text, this is what i am using.

[Code]...

View 1 Replies

Regex For Link Text?

Jun 18, 2012

i can use Regex matching to find urls in text, html source.But can Regex be used to get the link text (whats shown on screen) for that url it found e.g

<a href="www.mysite.com">Visit my site</a>

So for the above I want to return "Visit my site" Or do you just have to parse it.

View 1 Replies

Replacing Text With Regex?

Jan 2, 2010

I have 2 questions regarding replacing certain text in a string which has been found using regular expressions.For example this is my string:"<span style="font-weight: bold">This</span> is <span style="font-weight: bold">2010</span>"

View 4 Replies

.net - Regex Expression Get All The Text Between The Tags

Oct 19, 2010

I am trying to get all the text between the following tags and it is just not workind

[code]...

View 3 Replies

Highlight The Text Using With Regex Method?

Jan 5, 2010

I was wondering that if it possible to highlight the full text from the webpage using with regex match method and input the text in the label??

View 4 Replies

Select Underlined Text From Rtf Using Regex?

Jan 26, 2012

i want to select the next piece of text which is underlined. You see the rtf of a richtextbox has following code for an underlines text :

uli0 hello friendulnonei

But the normal text looks like underlined. What i want to do is on a click of button the rtfbox should select the next piece of text which is underlined. An example piece of text is :

hello [friend your] house [looks] amazing.

imagine the words within square brackets are underlined. When i first click button1 "friend your" should be selected and on next click "looks" should be selected. Kind of keep moving forward and keep selecting it type of application. I know this can be done using regex but can't build a logic.

View 1 Replies

Use Regex To Find A Dynamic Text?

Nov 29, 2009

I'm needing to use Regex to find a dynamic text. It will always be found between the same things. Now, I'm sure that made little sense, so let me clarify. I have a rich text box full of text. I am needing to use a Regex method to find a certain string of that text that is always different. This string will be located between the same two pieces of text every time.

For Example: If this is my string: id ="user_name" ><img style ="display: block;" usr ="resentful" I need to find the text in between id ="user_name" ><img style ="display: block;" usr =" and ".

View 5 Replies

VS 2010 Regex Of Formatted Text?

Aug 19, 2010

The text I am trying to put my pattern into is:

<li class="hp">
<span>HP</span>
<strong>1850 (+300)</strong>
</li>

The (+300) can go away...i'd really only like to return just the 1850.

View 1 Replies

Parsing Or Regex On HTML In A Text File?

Jun 26, 2009

I just spent about 2 hours searching this forum on this topic but I need some advice. I am looking to extract certain data from HTML source code that I have down loaded into a text file its about 9KB in size.I am looking to keep all email address found. How would this work or what would be the best method to use? This is what I would like to extract and write to another file:

[Code]...

View 20 Replies

Regex - Extract Text From Within First Curly Brackets?

Jan 31, 2012

I have strings that look like this {/CSDC} CHOC SHELL DIP COLOR {17}

I need to extract the value in the first swirly brackets. In the above example it would be

/CSDC So far i have this code which is not working

[Code]...

View 3 Replies

Regex - Richtextbox With Some Colored And Formatted Text

Jul 10, 2009

I have a richtextbox with some colored and formatted text

I'm using regex to put some html codes around the keywords so I can dump the output into a wiki i have

For example:

Code:

What I'm struggling with a little though is how to do the comments.

lets say I have:

CODE:

my regex does:

Code:

I can assume that if I see a -- then the rest of the line is green..

I have

Code:

which puts the font tag at the start, but dont know how to get the end of that line..

View 6 Replies

Regex - Verifying The Format Of A Text File?

Feb 9, 2011

I have an application that downloads a .txt file via FTP, and then it calls some sql to insert the file data into my database. I want to check whether the file is in the correct format before trying to insert.

The file should consist of some number of rows, each with the following format:

(4 letter code) (tab) (3 or 4 letter code) (tab) (date as dd-MMM-yy) (tab) (variable length text description) (tab) (1 letter code)

Is there a good way to check whether every line in the file follows this pattern, and warn me if it doesn't?

View 1 Replies

RegEx Slows Down If Text Not Read From RichTextBox?

Aug 22, 2011

I found a strange issue with the combination of RichTextBox and RegEx.If I load a text file into a RichTextBox and use

Dim matches As MatchCollection = Regex.Matches(RichTextBox1.Text, "^H(.+ ){10}
", RegexOptions.Multiline Or RegexOptions.IgnoreCase)

then the RegEx will run blazing fast.OTOH if I load the text from a file straight into a string and feed this string with RegEx.Matches using

Dim FullText As String = New StreamReader("c:TempTextFile.txt", System.Text.Encoding.UTF8, True).ReadToEnd
Dim matches As MatchCollection = Regex.Matches(FullText, "^H(.+ ){10}
", RegexOptions.Multiline Or RegexOptions.IgnoreCase)

then the regex will run for ages.Now obviously the RichTextBox does something to the text. I found that loading the text into the RichTextBox will eliminate the first 4 bytes of the text (is that the byte order mark?). However, trimming those 4 characters with SubString won't solve the problem. RichTextBox does some other processing that I'm unaware of.I'm using RegEx both on client and server side (client can load text files into a RichTextBox to test and setup various RegEx's and the server will process text files according to these previously setup RegEx's). Needless to say that a regex will run blazing fast on the text file loaded into a RichTextBox, while the very same RegEx ran through the very same text file will seem to lock up the server side service.My question: what kind of text processing does the RichTextBox do and how can I mimic the behavior in a server-side process?

View 1 Replies

Concatenating A Variable With A Regex Group Match In Regex.replace?

Apr 5, 2012

I am having an issue where I am using regex.Replace to replace part of a string. The basic idea is that I want to capture the beginning of the string then replace the end of the string with a value from code. For an example pretend I have a string that says "Test Number " followed by number and I want to increment that number. I capture the "Test Number " but when I try to concatenate that capture with the new number it treats the capture ($1) as a literal and replaces the entire string with $1[new number].

[code]...

This will output "We are on Test Number 2", as expected. how I can use a variable in the replacement string portion of the Regex.Replace when including a captured group?

View 1 Replies

App That Downloads Web Page And Using Regex Removes A Tag But Text Changes From 'Macy'

Jan 9, 2009

An have an app that downloads a web page and using regex removes a tag, but the text changes from "Macy" to ?Macy?, [code]

View 1 Replies

C# - Parse Using Regex Class Of System.Text.RegularExpressions

Mar 4, 2011

I have a string which i need to parse using Regex class of System.Text.RegularExpressions. I need to find if the first 2 characters of the string are either "00" or "07" or "16" or "23".

View 1 Replies

Regex - Form RegularExpression For Text Like Starts And Ends With #?

Jan 20, 2012

System.Text.RegularExpressions.Regex("#*#") is this correct..!? my text can be like #abc1234+as00# etc. ie, anything between #..#

View 4 Replies

REGEX - Find The Text Found With The TITLE Attribute

Sep 9, 2009

i want to be able to find the text found with the TITLE attribute which looks like this:

[Code]....

View 1 Replies

Regex - Get/split Text Inside Brackets/parentheses

Apr 25, 2012

Just have a list of words, such as:

gram (g)
kilogram (kg)
pound (lb)

just wondering how I would get the words within the brackets for example get the "g" in "gram (g)" and dim it as a new string. Possibly using regex?

View 3 Replies

Regex - Separating Text From Numbers Using Regular Expressions?

Nov 7, 2010

I'm having trouble parsing some text. Here's an example of the text:

201 BBQ 0.000 9.000 0.099 0.891 9.000 0.000 0.000 0.000
705 W 1 PC 0.000 135.000 0.295 39.825 0.000 0.000 135.000 0.000
2106 ONL 9.99 41.141 3.000 4.110 12.330 3.000 0.000 0.000 29.970

Here's the latest incarnation of the code I've been trying:

objInfo = System.Text.RegularExpressions.Regex.Split(
newLine,"(d{3,5})|([0-9]+[.]+[0-9]+)|(w*)")

I'm having trouble because I'm avoiding getting many blank spaces in the array after splitting. I'm trying to avoid using the optional | character but I get no results when I set it up without it!

I've spent much of the evening reviewing regular expressions and I've downloaded the following programs:

RegEx Designer.NET
Antix RegEx Tester
Expresso

I'm having trouble because the description contains a decimal point SOMETIMES and sometimes it doesn't. The description sometimes contains a whole number sometimes it doesn't.My friend recommended I use awk to divide it into columns. The thing is...I teach a Community Education class with Visual Basic .Net and I need to improve my RegEx skills.

View 1 Replies

RegEx To Parse Valid Paths From A Text File?

Sep 27, 2011

I'm attempting to parse a text file containing several Windows paths; I'd like to use regular expressions if possible, and I'm using VB.NET.The file is formatted somewhat like so:

M - Network Mode
C:ClientSystem - System Path
C:ClientProducts - Product Path

[code].....

View 2 Replies

Regex Regular Expression To Remove Lines Which Start With Certain Text?

Mar 24, 2012

I know it may be quite easily for you. i have a text which contains 40 lines, I want to remove lines which starts with a constant text. check below data.

When I used (?mn)[+CMGL:].*($) it removes the whole text , when I use (?mn)[+CMGL:].*(
) , it only leaves the first line.
+CMGL: 0,1,,159
07910201956905F0440B910201532762F20008709021225282808
+CMGL: 1,1,,159

[Code]...

View 1 Replies

System.Text.RegularExpressions.RegEx - String Or Word Negation?

Dec 6, 2010

I've been hammering at this over the weekend with no joy - been through page after page of RegEx Language documentation too.It's very easy to negate a match on characters. For example:

Dim MatchString As System.String = "<test0><test0><test1></test1></test0></test0><test0></test0>"
Dim NegationPattern As System.String = "([^<>])"
Dim RepStr As System.String = ""

[code]....

View 1 Replies

Increment Regex Match Using Regex.Replace

Jun 21, 2012

I'm creating a program in VB.NET to output multiple images. Some images will have the same file name. If there is multiple files with the same name I want to add "_1_" to the end of the file name. If the "_1_" file already exists I want to increment the 1 to be "_2_". If this file already exists I want to continue incrementing the number ultil it doesn't exist. So for example "filename", filename_1_", "filename_2_", etc. Here is the code that I have tried

[Code]...

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved