Käynnissä

Search and replace

Need to have a script, can be in PHP, Perl or a shell script to convert some text strings that appear in a file. They may appear any number of times in the text file

The basic pattern is <!--[gt ]--> inside there we can expect to see several params

domain, text, plural, count, category, html, tag

e.g.

<!--[gt text='hello']--> or <!--[gt text='apple' plural='apples' count='2']-->

Quotation may be with single or double quotes. The parameters can appear in any order. You only need to parse text, plural, and count

if plural is not present we need to replace the occurrence with <?php g('text'); ?>

if plural us present we need to replace the string with <?php ng('text', 'plural', 'count'); ?>

the words text, plural and count refer to the value of those parameters.

So a full example:

---START

<!--[gt text='hello']-->anything in between <!--[gt text='apple' plural="apples" count=2]-->

<!--[gt text="hello %s" tag="name"]--> more stuff<!--[gt plural="apples for %s" text='apple for %s' tag='you' html=1 count=2]-->more text and maybe some html etc.

---END

should become:

<?php g('hello'); ?>anything in between <?php ng('apple', 'apples', 2); ?>

<?php g('hello %s'); ?> more stuff<?php ng('apple for %s', 'apples for %s', 2); ?>more text and maybe some html etc.

Notice that the order when we translate is important for plurals, because we replace in the form ng(text, plural, count) even if the order was mixed up. Notice how we disregard all the other possible params.

The solution must be either a php script, perl script or shell script. Just needs to be able to read a file and output the file... nothing fancy and no interface at all. if writing in a PHP script just file_get_contents and file_put_contents is enough.

Taidot: Perl, PHP

Näytä lisää: up string, translate quotes, text string search, search text string, perl search script, pattern strings, pattern string, string pattern, search string, example shell script, basic shell script, fancy writing, search file, replace, apples, apple script, expect output file, name search number, count words text, shell script perl, replace text html, php search replace, string search, html text replace, search replace script

About the Employer:
( 1 review ) Roseay, Dominica

Projektin tunnus: #482631

Myönnetty käyttäjälle:

wildCat

check pm please

80 $ USD 1 päivässä
(284 arvostelua)
8.3

12 freelanceria on tarjonnut keskimäärin 58 $ tähän työhön

sisindia

Hi, Please see PMB. Thanks, Dharmendra

60 $ USD 1 päivässä
(40 arvostelua)
5.7
thetechbuddy

Can do it easily , have loads of experience with regex, string matching stuff .

40 $ USD 0 päivässä
(8 arvostelua)
4.2
spiczek

Hi, please check the PM.

60 $ USD 1 päivässä
(4 arvostelua)
3.1
kcmakkena

please check your pm.

30 $ USD 1 päivässä
(3 arvostelua)
2.7
amama

i already did two projects in perl,it's easy ,let's start

100 $ USD 2 päivässä
(2 arvostelua)
1.6
Amarjeet1984

i have long experience for these. lets start with me i will give you this work with in one day

65 $ USD 1 päivässä
(0 arvostelua)
0.0
polymetr

Hi. I can do it with perl.

30 $ USD 1 päivässä
(0 arvostelua)
0.0
alexgav

I am interested to your project. I am a Web Developer with extensive experience PERL I have 8 years of experience in software design and development web-based cross-browser and cross-platform systems. Thanks

75 $ USD 1 päivässä
(0 arvostelua)
0.0
mecrazycoder

I am very much comfortable with Perl. So i think i can complete this within 1 day itself.But since i need to test it aganist various testcase i need half day more.

30 $ USD 2 päivässä
(0 arvostelua)
0.0
ssrk

I am very much familiar with perl. Having 8 years experience in perl. Good in regular expression. Having experience in perl/cgi, mod_perl based web applications. I will complete this work within a day.

70 $ USD 1 päivässä
(0 arvostelua)
0.0
lyjbupt

Let's start to save time.

60 $ USD 3 päivässä
(0 arvostelua)
0.0