VBScript RegEx
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
View Replies
ADVERTISEMENT
I have been trying for days to learn regex, can't seem to get to grips with it at all .
Basically I need to remove all text between strings.
abcdef <mytag>ghijkl</mytag> mnopqr
would be left with
abcdef mnopqr
View Replies
View Related
I am struggling to find a solution to a relatively easy problem I have a string which contains a date in the format of: 20 Sep 2007 14:24
I would like to strip everything off after the month, so I am left with '20 Sep' is there an easy way to do this?
View Replies
View Related
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:
View Replies
View Related
I have this pattern to filter out bad words
regx.Pattern = "darn|dick|swear|blahblah"
it works, but in case of the word "dickinson"
the wordfilter also replaces dick in dickinson d***inson,
so i thought i could try this pattern
regx.Pattern = "darn|dick|swear|blahblah"
but no change, i've tested the regex with a similar PHP script and the operator works.
any clues why it wont work in asp?
View Replies
View Related
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?
View Replies
View Related
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:
View Replies
View Related
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 ?
View Replies
View Related
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?
View Replies
View Related
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.
View Replies
View Related
I need a pattern to do this:
"?caid=[0-9]+&pgid=oRS("pgId")"
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.
View Replies
View Related
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
View Replies
View Related
I am trying to write a regex function that will find all html tags with an id= value and get it to return the tag and value of the id.
i.e. <a href="blah.htm" id="someLink"> would return
a someLink
Any help would be greatly appreciated, this has got me very frustrated.
It will most likley be a very simple thing that I have missed.
View Replies
View Related
I have the following regex replace:
putDefInThis = RegExpReplace(putDefInThis, strPattern, "<a href=""" & lcase(replace("$1"," ","-")) & ".asp"">$1</a>")
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.
View Replies
View Related
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
View Replies
View Related
What's a way (like, for a username) to allow lowercase and uppercase letter, and numbers?
Code:
objRegExp.Pattern = "[a-z][0-9]"
objRegExp.Global = True
objRegExp.IgnoreCase = True
That's what I have, but I want to make the letters or numbers OPTIONAL, but right now they are required. how can I fix that?
View Replies
View Related
Can someone tell the ALL the reserved characters for regex?
View Replies
View Related
I have the following regular expression:
re.Pattern = "style[^=]*=[^""]*""[^""]*"""
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:
re.Pattern = "style[^=]*=[^""']*(""|')[^1]*1"
but it does not work.
View Replies
View Related
the isp i'm
using has authorized ssl on my site but i dont know how to tell a
particular page that it can only be run as a secure page... Where at the
moment u can view the page as https or http.
I'm assuming i need some code to detect whether its being run as a https
and if not redirect it to https.
View Replies
View Related
I have an ASP page, on the Window_OnLoad event I use VbScript to popup an Inputbox to accept a value from the user and put it into a string called strValue. I then want to be able to go (in asp)
<%Response.Write(strValue)%[color=blue]
> - but if I do that nothing happens.[/color]
How can I access the Vbscript variable in the ASP part of the page?
View Replies
View Related
I tried using some code examples from (URL address blocked: See forum rules) into my defualt.aspx page (in VS2005). I had some errors with this. I thought this might be cause the tutorial at w3schools.com said it was for *.asp files.
For example I had an error ("Statement cannot appear within a method body. End of method assumed) when I tried putting a SUB in the <head>. Like this
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "(URL address blocked: See forum rules)">
<html xmlns="(URL address blocked: See forum rules)" >
<head runat="server">
<%
sub vbproc(num1,num2)
response.write(num1*num2)
end sub
%>
<title>Untitled Page</title>
</head>
By the way if anybody will be available to answer basic questions like this every so often throughout the day (ie: check your email or this forum every couple of hours, until midnight California time December 8), I'd be willing to pay a reasonable amount. I just need help with some of the technical details like this + finding source code
View Replies
View Related
I manipulate MSAgent AcitiveX object using VBScript at client side, I
met a wierd problem when I debugged my ASPX page. when msagent recognize
a phrase and fire event, my vbscript capture the event and do something,
including make the agent do some animation and speech, then open a
browser window using 'window.open "www.google.com", "Google" '. the code
works fine when I view the ASPX page with browser inside VS.NET, when
browse this page in web browser from the localhost, the agent works
fine, but the new window did open up. why?
View Replies
View Related
I have COM+ component installed on my XP. I have problem to create
instance of it inside vbscript. How can I do it? The error I get is :
ActiveX component can't create object.
View Replies
View Related
I use vbscript in an asp file.
How can i take the last string in a variable.
For example:
abc="hello123"
newabc=???(abc)
and i only want the last string, that is "3".
means, if I do...
Response.Write newabc
The output will be : 3
View Replies
View Related
I'm trying to create a simple recordset, and would like to include an and/or option. to do this i set up an option on the previous page,and then sent the selection through to the next page. i was then hoping to simply insert the variable i had created into the code so that whichever of and/or is selected is used in the code. i.e.
where and_or is the variable from the previous page.
Search.Source = "SELECT * FROM dbo.Employee_List where First_Name='"&firstname&"' '"and_or"' Last_Name='" &lastname&"'"
so basically whenever someoned chooses an option its automatically filled in at the indicated location in the code. is it possible to do this and if so what is the correct syntax for using variables within this code?the full search function will have numerous fields so i'd like to avoid using if statements.
View Replies
View Related
I'am running window server 2000 and MS frontpage on my
computer. I created ASP page with the frontpage editor.
The asp code are not running when I am trying to view the
page with my browser (Explorer 5.0). Could you please help
me
View Replies
View Related
Trying to figure out how to do this (querying an access db using vbscript):
select * from comments where " & search & " = " & criteria & "
where " & criteria & " can be both a text and integer value.The above would work for " & search & " = 66 but not " & search & " = smith ?
View Replies
View Related
I have an ASP.NET solution,and the ASPX page I have a form ,I want to copy some of the data from that form to the clipboard,I am using the below script the script works fine when I use a normal anchor tag with the onclick event,but I want to be able to use an actual asp control like the hylperlink or linkbutton.
I have tried the link button but it gives an error saying Compiler Error Message: BC30456: 'VBScript' is not a member of 'ASP.sr_aspx'.
And the hyperlink control doesn't seem to have an option for the onclick. The code is located in the .aspx not in the .vb.
View Replies
View Related
I have absolutely NO knowledge about ASP. Though I've been working with PHP for almost 2 years and decided that I need to take the next step and learn some more languages both to keep me busy and to expand my skills.
Like I said...I have no knowledge or experience with this. From what I read, there are two ways of coding ASP. First using VBScript and then C#. I'm really confused, because for one, I don't know what the difference is, and secondly I'm ot sure which is the best.
I'll be primarily (if not only) be using ASP to build online applications, websites, etc.
View Replies
View Related
a dictionary of terms with definitions, (in a database) how can i hyperlink(automatically) words within the definitions for which a definition also exists.
url structure is like this
www.site.com/glossary?word=someword
Then - in the definition of "someword" there is a word that also has a definition in the database. I'd like to auto hyperlink it to that definition. Also since the data is all coming from a database, what if one of the words to be replaced has not yet come up in the loop? (...or would it be okay since EVERYTHING should be in the recordset?
View Replies
View Related
usually do perl and php. However, I would like to backup my databases with a microsoft sql server and sometimes a simple access database. In other words I would have a perl or php script that would insert data into a mysql database and at the same time post to a vbscript that will deal with the microsoft sql server or access database. I choose not to use perl or php to do the latter because I would like to keep every aspect according to its environment.
Almost every vbscript I've looked at is embedded in the html page. Since I intend to send via a post from a different type script - my question is can you place vbscript on the server as a stand alone? If this is possible - Where can I find references to this?
View Replies
View Related
I have a problem trying to run a vbscript on my desktop. The script runs fine on other desktops. Has it got to do with any security settings in my xp? and how do i enable it?
View Replies
View Related
i have a powerpoint file "somefile.PPT" . now MS-Powerpoint when open allows the file to be saved in JPG format .. this option is present in the SAVE AS.. option .. by this what happens is that the file is stored as an JPG image ...
is it possible to convert a given valid PPT file to JPG file without opening powerpoint and using VBSCRIPT code ...
View Replies
View Related