Regular expression to extract information

anjie451 -  
blux Posted messages 5003 Registration date   Status Modérateur Last intervention   -
Hello,

I'm looking for a formula to extract all spaces (blanks) from a text, and for that, I need to use regular expressions like [a-z A-Z]* [F f]red[a-z] which means any string containing the word Fred

Can someone help me???? I'm lost!
Thank youuuu
Configuration: Windows XP Firefox 3.5.7

4 réponses

blux Posted messages 5003 Registration date   Status Modérateur Last intervention   3 451
 
Hi,

what do you mean by 'extracting'?

--

A+ Blux
 "The idiots, they dare to do anything. That's how we recognize them." 
0
ziedzico Posted messages 438 Status Membre 112
 
Do you want to count how many words are in the text?
In which language?
0
anjie451
 
Extracting means spotting in a text all occurrences of my choice. In this case, therefore, the white spaces.
There is no specific language; we call this information extraction using regular expressions or patterns.
0
blux Posted messages 5003 Registration date   Status Modérateur Last intervention   3 451
 
I know how regular expressions work, but I still don't understand the meaning of your question: do you want to count them?

A regular expression can be used to delete characters, replace them, find them, or even assign them to variables for use in the same expression...

--

A+ Blux
 "Fools dare anything. It's even how we recognize them." 
0
anjie451 > blux Posted messages 5003 Registration date   Status Modérateur Last intervention  
 
Yes and no, I don't really need to know the number of spaces in my text, I just need to find the formula that highlights them in TextPad for example. I was thinking of this formula [^ ]+.
0
blux Posted messages 5003 Registration date   Status Modérateur Last intervention   3 451 > anjie451
 
[^ ]+
This is something that starts with several spaces...

In textpad, you search, and in the dialog box, you check regular expression and you can put either a space or a space in brackets (for readability).

Note that the [] are there to indicate a choice range.

--

See you Blux           
 "The idiots, they dare everything. It's even how we recognize them"
0
anjie451 > blux Posted messages 5003 Registration date   Status Modérateur Last intervention  
 
So to identify blanks in a text, would it be [ ] or not?
sorry, I'm just starting out...
1
blux Posted messages 5003 Registration date   Status Modérateur Last intervention   3 451 > anjie451
 
A blank is enough, it's just another character...

--

A+ Blux
 "Fools dare everything. It's even how we recognize them" 
0
ziedzico Posted messages 438 Status Membre 112
 
You need a LEX or FLEX on Linux to compose regular expressions and call a C method to count occurrences.
0