.net Regex Get Information?
May 31, 2010Well I am currently trying to get the word/text in between these 2 things
[Code]...
Well I am currently trying to get the word/text in between these 2 things
[Code]...
How do i can put more lines for specific information of regex?
...Regex("(?<=SOMETHING).+?(?=SOMETHING)")
Once again selected from RuneScape, because here is best code for it.
<tr class="row rowp4">
<td align="center">
<img class="miniimg" src="http://www.runescape.com/img/hiscores/skill_icon_strength1.gif">
</td>
[code]....
what i am trying to do is extract information beween two tags in some html from the source of a website. The contents of the text between the two tags will always be different. the code i currently have is;
[Code]...
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?
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>..
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]...
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 RepliesThe program is currently trying to pull information from three different database tables and compiling the information onto one screen, to do this i am using three different connections and a function to handle the data at each stage. The issue is as my code hits PageLoadStage of "2" and runs the QueryDatabase() Function i am encountering an error of: "OleDB exception unhandled: No value given for one or more of the required parameters." This occurs on line 15 of the first code snippet. Can anyone explain this and/or identify any code issues if that is the cause.
[Code]...
I was looking for some stuff online, and i was looking through my reference sheets for vb.net, but it seems in the code i have found, there is declare in methods. Below is an example i am talking about. The thing is, that i dont recognize it and believe that it is an earlier version of Visual Basic ( 6 or earlier) which used it. Should i just keep looking for different code?
Public Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal _
lpSubKey As String, phkResult As Long) As Long
Goal: Find information on how to implement a method which will check if a certain DSN exists, and then if it does, extract the information and use the information for connection purposes.
I have a text box where i am entering numbers of double datatype andon the Keytdown event of the textbox some checks take pace and in certain circumstances I want to be able to stop the user from entering other information until they enter the right information in the textbox (where it says right here) . now when I say exit sub the textbox somehow loses focus . but this is not how I want it to be I want the textbox to remain with the focus so the user can change the information . How can i go about this. And the other thing is why is my txtDestPayRate1.Focus() just befor the exit sub not working?
Private Sub txtDestPayRate1_KeyDown1(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles txtDestPayRate1.KeyDown
If e.KeyCode = Keys.Enter Then
[CODE]...
I am designing a backup/restore utility for work.atm i have been able to populate field for PC name, IP address, MAC address, number of printers installed on the PC but i am wondering is it possble to get all the printer information 'with the click of a button' to print all information like the prnmngr.vbs script down.I am able to run a batch file but i wanna get it to go from that app or even embed to batch file to the app and run it form there .
View 4 RepliesI am using VB2005 and trying to put an application together.What it needs to do is retrieve information from a binary file, possibly alter that information, and put it back into a new file.The file is a .wav file with data appened to the end. There is an additional section at the end of the .wav file which stores xml data.I have found that if I open this in a hex editor and make a 1:1 swap on any of the bytes that the application that the file is for can still read the XML.If I tried to add or remove characters from the XML then it would not read. I located a header byte and incremented it to resolve this.
This worked as an excellent bandage to do conversions where the data always needed to be changed to the same thing.What I have been asked to do is build logic that allows for different things to happen depending upon what data is contained within the file.The method that I am currently trying to impliment is:
Read through the file with a system.io.binaryreader
Searche for a bytestream that will signal data is coming
For example:
If System.IO.File.Exists("C: est estread.wav") Then
Dim findit() As Integer = New Integer() {&H3C, &H55, &H73, &H72, &H44, &H65, &H66, &H30, &H31, &H30}
Dim i As Integer[code].....
And then extract all the data till the end of element marker "<" It seemed like there should be a better way and I was looking for some insight. If I proceed with this method, I will have to read the file one time to gather the information and then a second time to write it all out with the header modified for length.This is my first experiene with working with binary files in this way.Also,I've been experiementing with building a string and slapping it back in at the end using the binarywriter.write(string) method.I noticed that it was putting in header characters before the string.These seem to change if I change the length of the string.At one point it was d0 07. Later it became e7 07. Does anyone know of a way to prevent this header from being inserted?
I tried a for each loop to grab all of the characters from the string, convert them to a byte array and deposit the byte array into the file, but the header remained the same. When I write the byte array generated from a system.io.binaryreader I do not get this header.
I have a fair bit of experience with VB.NET and C# (In this case I chose VB.NET, blame my laziness), but I do most of my professional work using PHP. I have no experience what so ever in using any database with VB.NET let alone MySQL.Just FYI, at the moment I am only trying to Query the database to gather the information required to activate. The Activation wizard and algorithm building (which is finished anyway), and everything else will come soon. I chose the MySQL database because I have experience with it, and it seems the best option for remote usage.The whole idea already works in PHP, I'm just have major issues moving it accross into VB.NET (Using the MySQL Connector.NET);I understand the basics, and all I need to know how to do is Count Rows and gain access to the other information in a row based on provoided information (in PHP, through mysql_ result)
So, here goes nothing, this is the Query code I am using in PHP to complete the job I want to do in VB.NET. [code] As you can see, I basically need to get the PHP code into VB.NET to fit into the 'btnQueryDB.Click' Command in VB.NET. By Equivalent, the Product ID in VB.NET will come from 'txtPID' and similar, Serial Number will come from txtSNUM. Once counted to be 1, the Activation Code and Status will be fed into 2 other text boxes in the form. (acCode, and acStatus).
I am using UrlRewriter.NET for urlrewriting...how do i write the regular expression for
[URL]
in this format <rewrite url = "~/ViewProfile/([^/.]+)" to="~/ViewProfile.aspx?uid=$1" /> what should be the rewrite url for [URL]
EDIT: Rewrite code in web.config file
<configuration>
<configSections>
<section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandle‌​r, Intelligencia.UrlRewriter" />
[code]....
I got xml document I want to parse. Here is example:[code]I want to get list of those to textbox like item1:1 newline item2:2 newline item3:3So its just like name+id and same for next..But sofar I got only item1 newline item2 newline item3
View 6 RepliesI've got an application which loads up some Excel files and imports them into a database.There are only certain of the sheets which I want, which are all timestamped and have either an am or pm on them. I put together a regex expression to look for that in the sheet name and skip it if it doesn't meet that criteria as:
View 6 Repliesi would like to use the following regex in VB.net:(d+.d+)|(??????)
how would i do it? i actually need to edit a string to put it in the specified format
i have a string similar to this one:
Hi, <<
ame>> <<surname>>, this is an example << est>>.
I what a regex that match and split this string in:
"Hi, "
<<
ame>>
" "
[code]....
I tried this one: (<<*.*?>>)|(>>*.*?<<), but doesn't work.
I have a html like this :
<h1> Headhing </h>
<font name="arial">some text</font></br>
some other text
In C#,
I want to get the out put as below. Simply content inside the font start tag and end tag
<font name="arial">some text</font>
I hired a coder to code me something in Regex. The issue was that he coded it in Visual Basic and I need it in C#. I tried using a converter but it didnt fix the issue.
string iamtwit = ss("http://www.mailinator.com" + GetBetween(GetBetween(iamtwit1, matches.ToString(), "</a>"), "<a href=", ">"));MessageBox.Show(GetBetween(matches1.ToString(), "<a href="", Strings.Chr(34)));
Here is the original code:
Dim iamtwit As String = ss("http://www.mailinator.com" & GetBetween(GetBetween(iamtwit1, matches.ToString, "</a>"), "<a href=", ">"))
MsgBox(GetBetween(matches1.ToString, "<a href=""", Chr(34)))
The error messages I am getting are:
The name 'GetBetween' does not exist in the current context
The name 'Strings' does not exist in the current context
I'm currently trying to get a regular expression to work and I can't seem to get it to, I've used the regex that I am using on an online tester and the text that I'm searching for is being selected alright, but I don't appear to be able to get it to work in VB.Net, so I was wondering if anyone would be willing to give me a hand.
The code I have is;
Private Sub getLink(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs)
[code].....
I would like to use regex for a txt file as follows. What I want to do is to get the whole text if CRC is other than 00000000. The content of the file below has 2 blocks of data below. And I should get the second one after the regex operation.
[Code]...
I'm using REGEX to scan the following two bits of javascript and get the stream url in the javascript codes below the regex.
REGEX:
Dim matchs As MatchCollection = New Regex("(window.SC.bufferTracks.push(){1}[^)^;]*();){1}").Matches(input)
Dim match As Match
For Each match In matchs[code].....
why it's working on one javascript, but not the other? (i've tested it on several, and it works on some and not on the others
How can i get the String Between this I tried everything but I just cant make it:
This is the String:
Quote:
<a title="I Need this String" href="/page/view_7894135/I_Need_This_String.html" class="tinylink">I Need this String</a>
This was my RegEx but it doesent work. I tried everything:
(?<=title="">).+(?="")
the string ordering does not matter Z, X, or c can be any order in the string but the regex must fail if all three are not present. I can easily do Three different regex but was wonder can this be done with one expression?
View 12 RepliesI want create macro for replacing. But my problem is how to use regular expression in Visual Basic's macro for Visual Studio?
document.Selection.ReplacePattern("test{[^']+}test", "testAAAAtest")
Doesn't work.
Use RegEx to get an Image URL?[code]...
View 3 RepliesI am using LINQ and RegEx to select a list of files that need to be zipped, based on information given by the user (includefiles and excludefiles) .
This code works great until there is an escape character in the path, such as C:Program Files(x86). At that point, no files are selected for zipping.
I'm very unfamiliar with LINQ and RegEx, but I think I need Regex.Escape("(") (plus any other characters). I just don't know how I should go about putting it into the code.
I can't find any examples that use LINQ and also include Regex.Escape.
Dim DI As New DirectoryInfo(sDirectory)
Dim FileList As IEnumerable = From F In DI.GetFiles("*.*", SearchOption.AllDirectories) _
[Code]....
i am not sure how to use those as a regex coding so basically i need help with translating the following shown below into regex coding: -(e.g. car as regex = new regex(" ") )
1. Car Licence Number (e.g.1ASD324)
2. Date(e.g. dd/mm/yy)
I am trying to validate a password by using a regex.
* Must be between 6 to 16 characters long
* Must contain atleast 1 uppercase letter
* Must contain atleast 1 lowercase letter
* Must contain atleast 1 numeric "digit"
So far so good ...
(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{6,16})$
Can optionally have any number of special characters listed below.