I have a problem with the % and / characters in Java regex. The following example will illustrate my issue:
Pattern pattern = Pattern.compile("^[a-z]*[/%]$");
Matcher m = pattern.matcher("a%/");
System.out.println(m.find());
It prints "false" when I expect it to be "true". The % and / sign shouldn't have to be escaped but even if I do...
Hi
We are currently converting our old base VB.Net to C #. Converting the bulk of the code is not a problem .. there are good converters around. The problem we are facing is that none of the tested converters can convert () in [] in arrays and collections.
Example: Session ("abcd") to Session ["abcd"];. Converters think Session is a me...
Hi Guys,
I am using below regular expression to remove comments from string
<\!{1}\-{2}(.*?)\-{2}\s*>
This is working fine except for mult-iline string
var search = '<\!{1}\-{2}(.*?)\-{2}\s*>';
var re = new RegExp(search, "gm");
var subject = <multi-line string>;
result = subject.replace(re, '');
what should I do to get i...
*strong text*I have a bunch of lines in a textfile and I want to match this ${ALPANUMERIC characters} and replace it with ${SAME ALPHANUMERIC characters plus _SOMETEXT(CONSTANT)}.
I've tried this expression ${(.+)} but it didn't work and I also don't know how to do the replace regex in java.
thank you for your feedback
Here is some o...
can anyone help me with a regex that will find files that dont have a .tar.gz extension
i need it to work in my unix script
for i in <REGEX for non tar.gx files>
do
something
done
thanks
...
Hey guys, question about regex in PHP!
For the given pattern, kinda like a shell terminal syntax:
application>function -arg1 value -arg2 value -arg3 value -arg4 value
I want to parse the arguments. This is my regex code
$command=' -arg1 value -arg2 value -arg3 value -arg4 value ';
// note the string begins by a space character and ...
Consider a string like this,
type="xxx.yyy.zzz, xxx.yyy, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null"
I read a resx file and would like to replace all occurrences of the above string with String.Empty no matter what the Version is, but the version format will remain the same and the rest of the string does not change. I tri...
I have an app that goes in, replaces "invalid" chars (as defined by my Regex) with a blankspace. I want it so that if there are 2 or more blank spaces in the filename, to trim one. For example:
Deal A & B.txt after my app runs, would be renamed to Deal A B.txt (3 spaces b/w A and B). What i want is really this: Deal A B.txt (one sp...
Does anyone know a regexp to extract just the video id from a Vimeo embed using php?
eg:
13084859
from:
<object width="400" height="225"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=13084859&amp;server=vimeo.com&...
I do Regular Expressions so rarely that they always challenge me. Even simple ones.
How can I make a regular expression that will match all of these:
:= 'abc'
:= 'xyz'
:= '2rs'
:= 'abe'
:= 'a2c'
Basically it starts with := ' and ends with ' and has three values inside. Could be numbers or chars.
...
var textTitle = "this is a test"
var result = textTitle.replace(' ', '%20');
But the replace functions stops at the first instance of the " " and I get the
Result : "this%20is a test"
Any ideas on where Im going wrong im sure its a simple fix.
...
Hello to everyone. I need to do this :
when a user insert a BBCode tag, with preg_replace and regex i do some trasformation.
e.g.
function forumBBCode($str){
$format_search=array(
'#\[url=(.*?)\](.*?)\[/url\]#i'
);
$format_replace=array(
'<a class="lforum" target="_blank" href="$1">$2</a>'
);
$str=preg_re...
I am looking for a way to split PascalCase strings, e.g. "MyString", into separate words - "My", "String". Another user posed the question for bash, but I want to know how to do it with general regular expressions or at least in .NET.
Bonus if you can find a way to also split (and optionally capitalize) camelCase strings: e.g. "myString...
Hi All,
Not sure if this is the best approach but I have some string which represents the orientation of some blocks. For example '3V6V' means a row of 3 vertical blocks, and a row of 6 vertical blocks. '3V6V6V' means row of 3, 6, 6 all vertical. '4H4H4H4H' would be 4 rows of 4 horizontal blocks. i.e. every 2 characters constitutes a ro...
I have written a function for adding emails to newsletter base. Until I've added checking validity of sent email it was working flawlessly. Now each time I'm getting "Wrong email" in return. Can anybody see any errors here ? The regex used is :
\b[\w\.-]+@[\w\.-]+\.\w{2,4}\b and it is 100% valid (http://gskinner.com/RegExr/), but I may ...
I have a file with lots of text editing using NotePad++.
for example
<span class="italic">some text</span><span class="bold">another text or some text</span>
I would like to use NotePad++'s regex replace to replace
<span class"italic>some text</span> to <i>some text</i> and <span class="bold">another text or some text</span> to <b>...
I am using a re.sub callback to replace substrings with random values, but I would like the random values to be the same across different strings. Since the re.sub callback does not allow arguments, I am not sure how to do this.
Here is a simplified version of what I'm doing:
def evaluate(match):
mappings = {'A': 1, 'B': 2}
re...
1) "glob:at row [0-9]" does not match "at row 7"
2) "glob:at row *" does match "at row 7"
Why does "glob:at row [0-9]" not match "at row 7"? How do I fix it?
...
This is sort of a secondary question to my question here but it was suggested split the questions up for a better response.
I have individual lines of data like the following that a passed to the function separately.
Mon-Wed 930-1700 Thu 900-1700 Fri 930-1700
Mon-Wed 930-1700 Thu 900-1700 Fri 930-1700 Sat 900-1200, Home Lending Sat ...
...I should just list them:
First 4 letters/numbers, with...
All lowercase.
Whitespace stripped.
Symbols removed.
Should be simple. What's the best way to do this?
...