23 questions
29
votes
7
answers
55k
views
How to extract two consecutive digits from a text field in MySQL?
I have a MySQL database and I have a query as:
SELECT `id`, `originaltext` FROM `source` WHERE `originaltext` regexp '[0-9][0-9]'
This detects all originaltexts which have numbers with 2 digits in it....
12
votes
2
answers
4k
views
Using str_word_count for UTF8 texts
I have this text:
$text = "Başka, küskün otomobil kaçtı buraya küskün otomobil neden kaçtı
kaçtı buraya, oraya KISMEN @here #there J.J.Johanson hep.
Danny:Where is mom? I don't ...
40
votes
9
answers
25k
views
How to get Git log with short stat in one line?
Following command outputs following lines of text on console
git log --pretty=format:"%h;%ai;%s" --shortstat
ed6e0ab;2014-01-07 16:32:39 +0530;Foo
3 files changed, 14 insertions(+), 13 deletions(-)
...
10
votes
2
answers
17k
views
How to find words from one file in another file?
In one text file, I have 150 words. I have another text file, which has about 100,000 lines.
How can I check for each of the words belonging to the first file whether it is in the second or not?
I ...
5
votes
2
answers
33k
views
Convert numbers to words with VBA
I have a column of numbers. In the next column, I want the text/word conversion of the numbers.
Example: 123.561 would convert to One hundred twenty three point five six one.
I do not want to ...
73
votes
7
answers
101k
views
How to split strings on carriage return with C#?
I have an ASP.NET page with a multiline textbox called txbUserName. Then I paste into the textbox 3 names and they are vertically aligned:
Jason
Ammy
Karen
I want to be able to somehow take the names ...
3
votes
2
answers
5k
views
Insert text on the current place of the cursor in the browser
I have a modal window which helps formatting text.
I have multiple textareas on the window.
The modal should not be attached to a specific textarea, so when I press an Icon in the modal window, I need ...
53
votes
6
answers
24k
views
excluding first and last lines from sed /START/,/END/
Consider the input:
=sec1=
some-line
some-other-line
foo
bar=baz
=sec2=
c=baz
If I wish to process only =sec1= I can for example comment out the section by:
sed -e '/=sec1=/,/=[a-z]*=/s:^:#:' < ...
16
votes
4
answers
63k
views
Java regex: newline + white space
should be simple, but I'm going crazy with it.
Given a text like:
line number 1
line number 2
line number 2A
line number 3
line number 3A
line number 3B
line number 4
I need the Java regex that ...
12
votes
9
answers
26k
views
Insert multiple lines of text before specific line using Bash
I am trying to insert a few lines of text before a specific line, but keep getting sed errors when I try to add a new line character. My command looks like:
sed -r -i '/Line to insert after/ i Line ...
11
votes
4
answers
9k
views
How to split file on first empty line in a portable way in shell (e.g. using sed)?
I want to split a file containg HTTP response into two files: one containing only HTTP headers, and one containg the body of a message. For this I need to split a file into two on first empty line (...
3
votes
2
answers
8k
views
Decoding unknown encoded Traditional Chinese character strings using Python
Hi I have a website that is in Traditional Chinese and when I check the site statistics it tell me that the search term for the website is å%8f°å%8d%97 親å%90é¤%90廳 which obviously makes no sense ...
2
votes
1
answer
5k
views
Find url in plain text and insert HTML A markups
I have text with URL and I need to wrap them with HTML A markup, how to do that in c#?
Example, I have
My text and url http://www.google.com The end.
I would like to get
My text and url <a href="...
0
votes
2
answers
138
views
How to format plaintext like a book/magazine with PHP?
I have:
This is a test string. Cool, huh?
I want:
This is a te-
st string. C-
ool, huh?
That is, each line is exactly 13 chars, according to the English rules for this. That is, I'm not sure if "...
21
votes
4
answers
12k
views
Shift a region or line in emacs
I'm looking for a way in emacs to shift text to the right or to the left by n spaces. A similar functionality that it in vim << or >>. It should work on a region or if no region is ...