Is it possible to use a regular expression to get filenames for files matching a given pattern in a directory without having to manually loop through all the files.
I have some text; I want to extract pairs of words that are not separated by punctuation. Thi is the code:
//n-grams
Pattern p = Pattern.compile("[a-z]+");
if (n == 2) {
p = Pattern.compile("[a-z]+ [a-z]+");
}
if (n == 3) {
p = Pattern.compile("[a-z]+ [a-z]+ [a-z]+");
}
Matcher m = p.matcher(text.toLowerCase());
ArrayList<String>…
How can I apply multiple regexs to a single string?
For instance, a user inputs the following into a text area:
red bird
blue cat
black dog
and I want to replace each carriage return with a comma and each space with an underscore so the final string reads as red_bird,blue_cat,black_dog.
I've tried variations in syntax along the lines of…
So I have defined variables in such a way in my file:
public static final String hello_world = "hello world"
public static final String awesome_world = "awesome world"
public static final String bye_world= "bye world"
I have many declarations like that.
Is it possible to format them as(All '=' in a line):
public static final String…
I have a problem with seperating information in a string i get from the external GPS stream.
Heres a example of a string:
$GPGSV,3,3,12,22,09,276,31,25,24,247,24,27,54,131,,32,04,359,19*71
$GPGLL,5703.85365,N,00953.88360,E,075510.00,A,A*69
$GPPWR,028a,1,0,1,1
$GPRMC,075511.00,A,5703.85369,N,00953.88430,E,0.335,302.17,070912,,,A*6E…
I am having a find a replace in a bunch of RTF documents, The basic pattern I need is
\{(?:\\\*)?\\field\\fldlock\{\\\*\\fldinst ?MERGEFIELD ?((?:\\.*?)?[\w\[\]]+?)(?:\\.*?)?\}(?:\{\\fldrslt\})?\}
However I then found out there could potentialy be a newline before each slash, so it turned in to this.
…
End of line anchor $ match even there is extra trailing \n in matched string, so we use \Z instead of $
For example
^\w+$ will match the string abcd\n but ^\w+\Z is not
How about \A and when to use?
Hi everyone. I'd ideally like a vim answer to this:
I want to change
[*, 1, *, *] to [*, 2, *, *]
Here the stars refer to individual characters in the substring, which I would like to keep unchanged. For example
[0, 1, 0, 1] to [0, 2, 0, 1]
[1, 1, 1, 1] to [1, 2, 1, 1]
If people know how to do…
I have an HTML document in .txt format containing multiple tables and other texts and I am trying to delete any HTML (anything within "<") if it's inside a table (between and ). For example:
===================
other text
<other HTML>
<table>
<b><u><i>bold…
So I have a string like this (the hashtags are delimiters)
A1###B2###C3###12345.jpg
I was wondering how would I access A1, B2 and C3
STRING1###STRING2###STRING3###STRING4.jpg
SOME###THING###HERE###MEH.jpg
EXTRACT###THIS###PLEASE###pah.jpg
In one instance I'd like to extract the first…
How can convert the below youtube urls
$url1 = http://www.youtube.com/watch?v=136pEZcb1Y0&feature=fvhl
$url2 = http://www.youtube.com/watch?feature=fvhl&v=136pEZcb1Y0
into
$url_embedded = http://www.youtube.com/watch/v=136pEZcb1Y0
using Regular Expressions?
This my simple data : <table></table><table></table><table>aaa</table>
how to match <table></table><table></table>***<table>aaa</table>***
it should be return <table></table><table></table>
Is there any way to exclude/delete/replace one field from a csv file with some regexp in notepad++?
I have a csv file with some data like this:
'1','data1','data2','data3','data4','data5','data6','data7','data8','data9',…
Hello,
Let's suppose that we have such HTML code. We need to get all <a href=""></a> tags which DO NOT contain img tag inside it.
<a href="http://domain1.com"><span>Here is…
Hi,
I would like to remove tag like the following one with its attributes using C# .Net
how can i do it?
<aaa type="1" class="2" />
other tags like <bbb type="5" class="4" /> i would…
I need a regular expression with the following needs:
the string is alphanumeric and have exactly 6 characters in the first half followed by hyphen(optional) followed by optional 4…
This is my code to pre_match when an amount looks like this: $ 99.00 and it works
if (preg_match_all('/[$]\s\d+(\.\d+)?/', $tout, $matches))
{ $tot2 = $matches[0];
$tot2 =…
I tried to create a regular expression which catches all RFC-valid addresses but it's ok if some false-positives come through (though hopefully not so many). This is waht I…
After seeing several threads rubbishing the regexp method of finding a term to match within an HTML document, I've used the Simple HTML DOM PHP parser…