C# - Regex To Find Percent Sign With Actual Math Value?

Jun 1, 2012

I have a string like 30+20%. Now I want to replace 20% with (20/100). Thats it.

View 6 Replies


ADVERTISEMENT

Why There Is Minus Sign In SQL Before Math In Parentheses.

Jun 4, 2012

I'm trying to learn LINQ to SQL. I've run into something I just don't get.Here's the LINQ program:[code]What I don't get is why there is a minus sign in the SQL before the math in the parentheses.I didn't specify that in the LINQ query.

View 6 Replies

REGEX Match With Math And Replace

Jun 3, 2011

I'm wanting to search a RTB for all X coordinate values and convert them to SI mm units.

I have two issues: 1. My code is stopping after the first instance of match.success, I'm guessing i'm using nextmatch incorrectly? I have also tried matchcollections with no success.

2. I fear once we get it progressing to the next X value, any multiple X values with the same dimension will be replaced with my replace command, causing the new value to be converted again.

Dim MatchObj As Match = Regex.Match(RichTextBox1.Text, "[Xx](?<X>(d*.{1,1}d{1,4}))(s)*")
If MatchObj.Success Then

[Code]....

View 11 Replies

Find Total Overlap Percent Of Multiple Rectangles ?

Jun 19, 2012

I've got a list of System.Drawing.RectangleF objects that all overlap the same RectangleF object.In my picture below, the 3 overlapping rectangles would be the pink, yellow, and red rectangles.My main rectangle in question is the light blue rectangle.

Second Image: I know that with RectangleF objects I can use the Intersect() method that will return me another RectangleF object representing the overlap. But as far as I can tell, this only really works when comparing two rectangles.

My question is: How could I determine the TOTAL area/percentage (i.e. the combined total overlap of the red, yellow, and pink rectangles when compared to the light blue rectangle - but it would need to be smart enough to not count the area in which the red and yellow overlaps twice, and same for the pink and yellow)?

NOTE: The green lines represent the area I'm looking for, just the total area of the blue rectangle that is not visible.

UPDATE: I've added a 2nd image to further demonstrate what I'm looking for. In the second image, the presence of the burgundy rectangle should have no affect on the total percent covered because that area is already covered by the yellow and green rectangles.

View 2 Replies

Math.min - Find Smallest Number Typed By User In Text Box 1

May 3, 2011

I have two text boxes on my form. text box 1 allows a user to type in a number (decimal) and text box 2 will display the smallest number typed in so far. The idea is to find the smallest number typed in by the user in text box 1, by using the Math.min method to compare each number typed in by the user to a variable that contains the smallest number to the point. Then replace the variable value with the smaller of the two numbers. To make it work for the first number. I have to initialize the variable to 99999. (no if else statements should be used).

View 3 Replies

VS 2010 Hmwk - Display The Largest And Smallest Using Math.max - Math.min

Mar 5, 2012

well i am having a couple of issues with this particular homework problem and this is my first programming class so there is probably quite a few mistakes well the homework problem is to take three double values entered by a user and display the largest and smallest using math.max and math.min and display the smallest and largest so i thought i could use a listbox and take the values that went to the listbox and assign variables to each so i can try to use each variable in the math.max and min but im not making it to far and i actually might be way off

[Code]...

View 4 Replies

Sign Converted To [] (square Sign) When Importing

Dec 1, 2010

Im importing text from a .txt file using streamreader and when it reads in a � sign it converts it to the square symbol for a unknown character! If i put in a $ sign it imports it correctly!

View 2 Replies

Find All Regex Matches

Jun 28, 2010

[code]I am trying to return all number values that match the regex yet this only returns the first one when there are more after it.

View 5 Replies

Can't Find Correct Pattern For Regex?

Mar 3, 2012

I need your help to find the right pattern to extract a string that i need.. The problem is that i have to extract all there is between this caracters:<a href="/url?q=(text to extract whatever it is)& I tried this pattern, but it's not working for me! : /(?<=url\?q=).*?(?=&)/

i'm programming in Vb.net, this is the code, but i think that the problem is that the pattern is wrong:

Dim matches As MatchCollection
matches = regex.Matches(TextBox1.Text)
For Each Match As Match In matches
listbox1.items.add(Match.Value)
Next

View 3 Replies

How To Find Regex Pattern Matches

Mar 12, 2012

I am working on my application to extract the value from my php page using with the regex pattern. I can extract the value using with the mystrings1 tags with no problem, but I can't be able to extract mystrings1 and mystrings2 tags in the same line.

[Code]...

View 2 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

.net - How To Write Regex To Find Stock And Price

Jan 19, 2011

var rawItemInfo={"stock":"In Stock","shipping":"<em>Free Shipping</em>","finalPrice":"56.99","itemInfo":"<div class="grpPricing"><div class="wrapper"><div class="current" id="singleFinalPrice"><span class="label">Now: </span><span>$</span>56<sup>.99</sup></div></div><div

I want to extract two information from above string

1: Stock Status "In Stock" which will come always after "Stock":

2 Price $56.99 which is there some before....<span>$</span>56<sup>.99</sup> some code after..

View 1 Replies

Find A Set Of Numbes In Long String Using RegEx?

Oct 28, 2011

Ive been searching the Stackoverflow but couldnt find the exact thread that my problem is this, i want to be able to find and take out any occurances of 8 digits wihtin a string.

Dim SetOfMatches As MatchCollection
Dim MyRegex As New Regex("A^d{8}$A")
Dim TestString As String = "testing 12345678 testing"
myMatches = myRegex.Matches(TestString)
For each Row as Match in myMatches
console.writeline(row.value)
Next

this doesnt not generate any hits. but i want to find the 8 digit occurance in the middle of the string.

I am very basic in RegEx.

View 1 Replies

Regex Pattern To Find Illegal Characters?

May 21, 2010

I need to find illegal characters in a windows forms textbox

The textbox text is sent as an sms text message and illegal characters are not allowed

e.g 1 client pasted some text from a word document into the texbox and the ' in msword appears as slanting ' in the textbox (see below)

e.g msword text - This is a new test of the Services

after pasting in textbox - This is a new test of the Services

The sms company have advised the slanting apostrophe is a unicode character

How can I find characters like above so I can remove them before sending the sms text

View 2 Replies

VS 2008 : Regex Find By String With Html?

Mar 12, 2010

#@$#^@ regex have i don't know to use it yet so something like

<img src="find this" alt="Click if
<img src="/validator/11917876/1268416778.gif" alt="Click if

I'm trying to get this src and have PictureBox1.Load[URL] & "regex code" for the captcha to see if over picturebox1

View 6 Replies

VS 2010 Regex To Find A Pattern In File?

Jan 21, 2012

have a 1mb file, should get the pattern from it

pattern should be like this
6numbers + 10&FF + 6numbers
in the hex binary editor it looks like this

[code].....

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 To Find A Word That Includes An Escaped Character?

Jul 17, 2009

I am using a simple regular expression (in C#) to find a whole word within a block of text.

The word may appear at the beginning, end or in the middle of a the text or sentence with in the text.

The expression I have been using word has been working fine however if the word included a special character (that has been escaped) it no longer works. The boundary is essential so that we do not pick up words such as vb.net as a match for .net.[code]...

View 3 Replies

Regex To Find Alphanumeric Match With Day Part Of Datetime?

Jan 5, 2012

I have to match string like "DAY1","DAY2","DAY3"....."DAY31" with regex in vb.net. I tried something like this - ^?DAY(0[1-9]|[12][0-9]|3[01])$ but it did not work.

The pattern should have succesfull match if the source string is either DAY1 or DAY2 or DAY3 to DAY31 like so.

View 1 Replies

Build Regex To Find And Replace Invalid HTML Attributes?

Jul 31, 2009

The sad truth about this post is that I have poor regex skills. I recently came across some code in an old project that I seriously want to do something about. [code]...

View 5 Replies

Regex - Find First Use Of Particular Word In String & Then Display Image Url Which Is Exacly After It?

Feb 6, 2011

I have a string which consists of the raw HTML of a webpage. I would like to search for the first use of /imgres?imgurl= within the string and display the url of an image which follows exactly after it in a text box. Below is an example of part of the string: [URL]..In this case it would find /imgres?imgurl= then it would display [URL]...

View 2 Replies

Use RegEx To Find The <tr></tr> That Contains The Text "World"?

Dec 8, 2009

I have the following html contained in a string.

<tr>
<td>Hello</td>
</tr>

[Code]....

I would like to use RegEx to find the <tr></tr> that contains the text "World". The difficulty is that there might be other <td> around the one that contains the search text. So we need to be able to search for the <tr> and </tr> nearest to the search text with any text between the <tr> and the search text.

The result of the match would be.

<tr>
<td>World</td>
</tr>

I'm using vb.net by the way.

View 1 Replies

Using RegEx To Find String Inside Nested String?

Sep 10, 2011

Using VB.NET, Is there a way to do this RegEx call in 1 step... instead of 2-3? I'm trying to find the word "bingo", or whatever is between the START and END words, but then also inside the inner FISH and CAKES words. My final results should be just "bingo".

Dim s1 As String = "START (random string) FISH bingo CAKES (random string) END"

[Code]...

View 2 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

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

Percent-encode URL Twice?

Apr 11, 2012

I have been given some instructions to percent encode a URL twice. I know how to percent encode a URL once but how do you do it twice? Surly when it is encoded once, it will be the same when encoded again.

View 2 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

Regex Builder That Actually BUILDS RegEx From A Highlight

Nov 17, 2011

I've been working straight since yesterday trying to get this to work. I'm a noob to RegEx and I've tested out about 5 different RegEx "builders" but each of them require you to navigate through the options to build the Regex...each of them has failed when I try to use them.Is there an application out there free/paid where you select the line you want to grab and the RegEx is auto generated from that highlight rather than having to try to build the line of code? [code]

View 1 Replies

Add Convert A Variable To Percent?

Jun 21, 2010

Public Class Form1
Private Sub btnCompute_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCompute.Click
Dim percent As Double

[Code]....

Above is the code i have created. I am having issue with the variant "Percent" to display 37.50% instead of 37.5.

View 4 Replies

Calculate Percent From 2 Different Inputs?

Oct 12, 2010

vb.net
'' Project name: Golf Pro Project
' Project purpose: Displays the commission based on a

[code]......

i dont know how to assign variables and im juist totally lost right now and this is due today and i was sick 2 weeks and am 2 chapters back.

View 11 Replies







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