I have a text search which reads a textfile and displays each line that has a value the user is searching for. It's practically finished except when it searchs it doesn't look for exact matches (e.g a searh for Ali would return Alison or Alice).
How would i go about using RegEx's to prevent this by making the search look for the exact word entered? Code:
I am trying to do some custom forum code, like using [ b ] as a tag and replacing it later using RegEx. The problem is, its not replacing quite right. Its leaving in the []s and its not closing some of the tags.
Here is my pattern: "[ b ]((.| )*?)[/ b ]" Here is my replace text: "<b>$1</b>"
Here is some sample text: "yada yada yada [ b ]hey![/ b ] yada yada"
Now, another thing, I would like it to close tags if they aren't closed properly. Is this possible?
im trying to use Regex to replace some text in my string. I want to replace some text to html tags eg. [b] to <b>, [u] to <u>.
How can I please use like a wildcard for the letter in between the tags. What am i doing wrong in this code, should i replace $1$2 to something else please: Code:
I made a regular expression to match Guitar Chords.
[A-G](#|b)?([a-z]|[0-9])*
This pattern should find any of the following:
1) G 2) Gmaj 3) G7 4) G# 5) Gb 6) G#min
The pattern works for all of these except for #4. For some reason it will only return the 'G' instead of the full 'G#'. I find this very odd because if the chord is 'Gb', the regex will return the full 'Gb'.This pattern works fine in javascript. Is there anything special with the '#' character in RegEx for VBScript? I am using VBscript engine 5.6
I'm using regular expressions to identify in a string an url ad format it in hyperlink.
The problem is that in the same string should be bbcodes and the [url] one tooo... so when the regexp will format the code will format the one in bbcode too.
The solution would be the lookaround function of RegEx to see if behind the match there is the [url] code... but it's not implemented in VisualBasicScript. Is there any way to use this function in my script ?
Is it possible to have more then one pattern for the .pattern variable. If I'm to execute and search and replace on a specific string can I make it so my .pattern will ignore specific keywords and not just A keyword?
i have text, in it i want to highlight the words user used to find this result. i used the normal replace, it worked fine except the case thing..
SearchForSp = Split(SearchFor, " ") For i = 0 to Ubound(SearchForSp) EmpJobsText = Replace(EmpJobsText, SearchForSp(i), "<strong><u><font color=red>"&SearchForSp(i)&"</font></u></strong>", vbTextCompare) EmpJobsText next
i tried to use the regEx.Repalce from the examples in groups but just couldn't find a way. problem is in the normal replace function i have option to supply a source. in this case "EmpJobsText" is the source. but regEx.Repalce don't seem to have place to type where to replace, only what to replace with what.
Where [0-9]+ means you need atleast 1 number there, the rest is just a string plus my recordset's variable. I know this syntax would work with the regex I learned at school but I'm not sure how to make it work in ASP.
I have a string that I want to check to be sure there are no single or double quotes in it. Using RegEx should be possible but I cannot figure out how the syntax should go. I am programming in ASP.NET with C# as the code behind. here is one I know works to be sure there are only numbers in the string, but i can not for the life of me figure out the right syntax for quotes
The problem is that i can not get the vb replace to work on the "$1" in the url. $1 is such that it can be multiple words separated by a space. for the href, I need to convert the space to "-". It does not do that with the way I hvae the code above.
how to add the symbol ' (Apostrophe) to the code so that the validation accepts this within a surname such as o'neill? this is wot i hav at the minute:
With regExName .Pattern = "^[a-z]+$" .IgnoreCase = true .Global = true End With
It will grab any style attribute within HTML that uses double quotes, and put it in the re.Matches collection.Now, I want to include single quotes into this regular expression. Here's what I have so far: