English 中文(简体)
• 如何寻找一种公式,并对垂直[封闭]的地段作一些改动
原标题:How can i search in a formula and make some changes in string parts with perl [closed]
  • 时间:2012-04-18 05:28:10
  •  标签:
  • regex
  • perl
Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 10 years ago.

意欲从公式中提取小数,以后再作一些改动,并重述:

((dfhkuyhu.hkjgd.hjkh + hgdfjg.uyrepo.uyu + hgdfjg.uyrepo.uyu)/(hgdfjg.uyrepo.uyu))*((khuh.jbmxcn.bnb + hgdfjg.uyrepo.uyu)/(jhxzku.kjkj.jh + hgdfjg.uyrepo.uyu))

and i want to add something tobeginning and end of each part like this:

((Foo!dfhkuyhu.hkjgd.hjkh![hg] + Foo!hgdfjg.uyrepo.uyu![hg] + Foo!hgdfjg.uyrepo.uyu![hg]).[boo]/(Foo!hgdfjg.uyrepo.uyu![hg]).[boo])*((Foo!khuh.jbmxcn.bnb![hg] + Foo!hgdfjg.uyrepo.uyu![hg]).[boo]/(Foo!jhxzku.kjkj.jh![hg] + Foo!hgdfjg.uyrepo.uyu![hg]).[boo])

任何想法?

问题回答

这些规则不明确,但似乎你试图将每一行的甲型数字特性(加上分离剂量)与/ 。 权利?

然后,你可以这样做:

$subject =~ s/[w.]+/Foo!$&![hg]/g;
$subject =~ s/)/).[boo]/g;

<>Explanation:

<代码>[w.]+对像dfhkuyhu.hkjgd.hjkh的体格表示。 在替代体中,<代码>$&指对应文本。 <代码>/g 旗帜 能够找到并取代插座中的所有配对。

<代码>与字面括号一致。





相关问题
Why does my chdir to a filehandle not work in Perl?

When I try a "chdir" with a filehandle as argument, "chdir" returns 0 and a pwd returns still the same directory. Should that be so? I tried this, because in the documentation to chdir I found: "...

How do I use GetOptions to get the default argument?

I ve read the doc for GetOptions but I can t seem to find what I need... (maybe I am blind) What I want to do is to parse command line like this myperlscript.pl -mode [sth] [inputfile] I can use ...

Object-Oriented Perl constructor syntax and named parameters

I m a little confused about what is going on in Perl constructors. I found these two examples perldoc perlbot. package Foo; #In Perl, the constructor is just a subroutine called new. sub new { #I ...

Where can I find object-oriented Perl tutorials? [closed]

A Google search yields a number of results - but which ones are the best? The Perl site appears to contain two - perlboot and perltoot. I m reading these now, but what else is out there? Note: I ve ...

热门标签