How to Find and Replace with RegEx??

  • Автор темы Автор темы TK421
  • Дата начала Дата начала

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!
 
Ok, found it!! Didn't realize there was already a Macro for it!
 
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
 
bump

Anyone??
 
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
 
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!
 
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;
 
Thanks Lannister that code is a bit beyond me though!

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

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