How to Find and Replace with RegEx??

TK421

Client
Регистрация
24.07.2011
Сообщения
58
Благодарностей
9
Баллы
0
All my articles are taken randomly from a folder by Zennoposter to post on various different web 2.0 sites.

They are all in this format: <p>content</p>

However now I want to post some of these on wiki sites where <p></p> is not supported. Instead they use [[div]][[/div]]

So once Zenno has pulled a random article I want to parse it with a regular expression and change all the <p></p> to [[div]][[/div]] before it posts it.

Is this possible and if so can someone give me the regex for this??

Thank you!
 

TK421

Client
Регистрация
24.07.2011
Сообщения
58
Благодарностей
9
Баллы
0
Ok, found it!! Didn't realize there was already a Macro for it!
 

TK421

Client
Регистрация
24.07.2011
Сообщения
58
Благодарностей
9
Баллы
0
I've got another question that is related to the 'Replace all strings that match a specified regular expression'.

The problem is that I only want to replace one string and not them all. To keep it simple it can be the first the first string within the text.

For example:

"As far as SEO software is concerned Zennoposter is the best SEO tool on the market"

I only want to replace the first instance of SEO within the text.

If someone could give me the answer I'd appreciate it!

Thanks
 

TK421

Client
Регистрация
24.07.2011
Сообщения
58
Благодарностей
9
Баллы
0
bump

Anyone??
 

shinigami

Client
Регистрация
01.05.2011
Сообщения
164
Благодарностей
91
Баллы
0
1. take the first line with removing
2. take a whole text except the first line (which is already removed) with removing
3. change first line
4. add to the file changed first line
5. add the whole text you took in step 2
 

TK421

Client
Регистрация
24.07.2011
Сообщения
58
Благодарностей
9
Баллы
0
Thanks for the answer.

The the first instance of the word I want to change isn't always in the first line so it wouldn't work.

You've got me thinking though, maybe I could split the text with first instance of the word being the divider. Then change it and add it back in using your method..??

I thought there would just be a simple macro I could use to replace only one string... nevermind!
 

Lannister

Client
Регистрация
28.08.2011
Сообщения
19
Благодарностей
2
Баллы
0
maybe this code will help you :

var txt="phrase1. phrase2";
var taille = txt.length;
var espace=txt.indexOf('.',1);
var chaine1="new phrase"
var chaine2=txt.substr(espace, taille);
var phrase=chaine1+chaine2;
 

TK421

Client
Регистрация
24.07.2011
Сообщения
58
Благодарностей
9
Баллы
0
Thanks Lannister that code is a bit beyond me though!

I've solved it anyway with a combination of macros.
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)