Dim strPattern As String: strPattern = "[^a-zA-Z0-9]"
Dim regex As New RegExp
regex.Pattern = strPattern
result = regex.Replace(pFileNameWithoutExtension, "_")
It does work but it replace only 1 char. How can I replace more than one char. Example : "ÉPÉ" should be "P" but currently the result is : "_PÉ"?
...
Hey can anyone whip up a regex that i could use to validate strings containing only alphanumeric characters along with ' ', '-', '_', and '.' ?
Thanks
...
Hi, I have to insert a string after a certain character using Ruby.
For example, if I have a line like the following:
(N D CGYRWIFGD2S7 0 1 N)(N D CGYCGYOVFBK0 0 N N)(ISA N N N CGYCG3FEXOIS N PUB NONE N N 0)(ISA N N N CGYCGYFGAOIS N PUB NONE N N 0)(ISA N N N CGYCG2FGAOIS N PUB NONE N N 0)(N D CGYCGYOVFBK1 0 N N)(N D CGYLOCFGA2S7 0 N N...
I have a text file with various entries in it. Each entry is ended with line containing all asterisks.
I'd like to use shell commands to parse this file and assign each entry to a variable. How can I do this?
Here's an example input file:
***********
Field1
***********
Lorem ipsum
Data to match
***********
More data
Still more data
*...
I'm trying to create a regex for checking values of submitted tags for a free form folksonomy system. Here is what I have now.
if (!preg_match('/([^-\\a-zA-Z0-9._@\'])+/',$proposedtag)) {
//true, good
return true;
} else {
//false, bad characters
return false;
}
I want to allow: hyphen, backslash, forward slash, a-z, ...
I am trying to determine if a string has more than 1 capital letter in a row at the start of a string. I have the following regex but it doesn't work:
`^[A-Z]{2,1000}`
I want it to return true for:
ABC
ABc
ABC ABC
ABc Abc
But false for:
Abc
AbC
Abc Abc
Abc ABc
I have the 1000 just because I know the value won't be more than 10...
Been banging my head against the wall on this one all day and am getting close to my wits end on this. Looking for some fresh perspective.
Sample Input Text:
(line breaks added for clarity, not in actual data )
</div>#My Novel<br />
##Chapter1<br />
It was a dark and stormy night<br />
##Chapter 2<br />
The End
Desired Output
<...
I want to do this in Perl:
>> "foo bar baz".scan /(\w+)/
=> [["foo"], ["bar"], ["baz"]]
Any suggestions?
...
Related (but not the same):
Javascript Regex: How to bold specific words with regex?
Given a needle and a haystack... I want to put bold tags around the needle. So what regex expression would I use with replace()? I want SPACE to be the delimeter and I want the search to be case insensitive and I want special characters (such as @!...
How comes this writes False?
Console.Write(Regex.IsMatch("[abcde]{1,16}", "babe"));
What's wrong with my regex? Doesn't that regex roughly translate to: contains between 1 and 16 characters, a through e?
...
Is there a special regex statement like \w that denotes all printable characters? I'd like to validate that a string only contains a character that can be printed--i.e. does not contain ASCII control characters like \b (bell), or null, etc. Anything on the keyboard is fine, and so are UTF chars.
If there isn't a special statement, how c...
I’m stuck in trying to grep anything just after name=, include only spaces and alphanumeric.
e.g.:
name=some value here
I get
some value here
I’m totally newb in this, the following grep match everything including the name=.
grep 'name=.*' filename
Any help is much appreciated.
...
This is a slightly modified version of the question here. The difference is I don't the special characters to be included in the bold tags if they are on front or back.
Given a needle and a haystack... I want to put bold tags around the needle. So what regex expression would I use with replace()? I want SPACE to be the delimeter and I ...
For example, given the pattern
[a-zA-Z]_[0-9]{2}
a function would take the pattern and return an array or list containing
a_00, a_01, a_02, ... , a_98, a_99, ... , z_98, z_99
Only numbers and letters (and finite groupings thereof) need be expanded. How would I go about doing this? An example in Python or Perl would be preferred. Th...
I have this Perl snippet from a script that I am translating into Python. I have no idea what the "s!" operator is doing; some sort of regex substitution. Unfortunately searching Google or Stackoverflow for operators like that doesn't yield many helpful results.
$var =~ s!<foo>.+?</foo>!!;
$var =~ s!;!/!g;
What is each line doing? I...
Python came pre-installed on my macbook and I have been slowly getting acquainted with the langauge. However, it seems that my configuration of the re library is incorrect, or I simply misunderstand something and things are amiss. Whenever I run a python script with "import re", I recieve the following error:
Traceback (most recent ca...
If i have data in my MySQL like this
table:
data(TEXT)
foo (hal)
foo (dave)
bar (dave)
bar(dave)
And i want to do This Query
SELECT DISTINCT(data) FROM table;
Now this will return the table as listed above. But i want to do is some sort of replace so that my return query should look like this
SELECT D...
I'm becoming acquainted with python and am creating problems in order to help myself learn the ins and outs of the language. My next problem comes as follows:
I have copied and pasted a huge slew of text from the internet, but the copy and paste added several new lines to break up the huge string. I wish to programatically remove all ...
I'm building a simple chat app with Rails. when a user types in a url, I want it to be output as an html link (ie, "url").
I was wondering if there is any library or well known way to do this in Ruby. If not, I've got some decent regex sample code to work with...
...
How can I use Eclipse to search all files which have this on their first line:
<?
instead of this:
<?php
The following isn't working:
...