473,395 Members | 1,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to create tags from one content to another content using PERL

You can see the above two stings, that $string_2 contents are available in $string_1 but the only difference is tags (ie: <a> or <sup>).

I want to match $string_2 in $string_1 and have to create/copy what are the tags inside in $string_1 matching area to the $string_2 contents.


Kindly anybody give any idea to solve this

Thanks
Vimal

Expand|Select|Wrap|Line Numbers
  1. my $string_1 = "Noch befinden wir uns aber in der 1. Generation, so dass diese institutionalisierten Handlungsweisen nach wie vor durchschaubar und als menschliche Konstruktion ersichtlich sind. Der Institutionalisierungsvorgang endet erst im Zuge der <i>Internalisierung</i> der Folgegeneration durch die (Prim&#x00E4;r)sozialisation, in der die kollektiven Wissensbest&#x00E4;nde als Teil der subjektiven Wirklichkeit verinnerlicht werden. Erst hierdurch werden die Institutionen als Teil einer absolut wahrgenommenen objektiven Wirklichkeit angesehen. Sie erhalten dadurch objektiven Charakter. Diesen Vorgang der Vergegenst&#x00E4;ndlichung nennt Berger/Luckmann <i>Objektivation</i>. Der Eindruck eines menschlichen Erzeugnisses verschwindet. Die Institutionen werden als naturgegebene, unhinterfragbare und nicht ver&#x00E4;nderbare faktische Gegebenheiten angesehen, als kollektiv geteilte Wissensbest&#x00E4;nde. Die Autorit&#x00E4;t der Institution an sich, die sich aus ihrer historisch bedingten Faktizit&#x00E4;t ergibt, sowie die Autorit&#x00E4;t der Bezugspersonen, die gesellschaftliche Institutionen, Normen und Verhaltensweisen &#x00FC;bermitteln, f&#x00FC;hren dabei zu einem regelkonformen Handeln der <a sdj="asdas"><sup>saddfsdfsad</sup></a> Nachkommen (Berger/Luckmann <sup>21</sup>2007, 62&#x2013;72)."
  2.  
  3. my $string_2 = "regelkonformen Handeln der Nachkommen (Berger/Luckmann 2007, 62&#x2013;72)."
  4.  
  5. ----------------------------------------------------
  6.  
May 16 '14 #1
1 1191
miller
1,089 Expert 1GB
The following script will match at least this example data:

Expand|Select|Wrap|Line Numbers
  1. use strict;
  2. use warnings;
  3.  
  4. my $string_1 = do {local $/; <DATA>};
  5.  
  6. my $string_2 = "regelkonformen Handeln der Nachkommen (Berger/Luckmann 2007, 62&#x2013;72).";
  7.  
  8. # Build a regex to match HTML interjected at whitespace
  9. my $string2_re = join '(?:\s+|<(\w+)\b.*?</\g{-1}>)+', map quotemeta, split ' ', $string_2;
  10.  
  11. if ($string_1 =~ /($string2_re)/) {
  12.     print "Matching = '$1'";
  13. }
  14.  
  15. __DATA__
  16. Noch befinden wir uns aber in der 1. Generation, 
  17. so dass diese institutionalisierten Handlungsweisen nach wie vor durchschaubar 
  18. und als menschliche Konstruktion ersichtlich sind. Der Institutionalisierungsvorgang 
  19. endet erst im Zuge der <i>Internalisierung</i> der Folgegeneration durch die 
  20. (Prim&#x00E4;r)sozialisation, in der die kollektiven Wissensbest&#x00E4;nde als Teil 
  21. der subjektiven Wirklichkeit verinnerlicht werden. Erst hierdurch werden die Institutionen 
  22. als Teil einer absolut wahrgenommenen objektiven Wirklichkeit angesehen. Sie erhalten 
  23. dadurch objektiven Charakter. Diesen Vorgang der Vergegenst&#x00E4;ndlichung nennt 
  24. Berger/Luckmann <i>Objektivation</i>. Der Eindruck eines menschlichen Erzeugnisses 
  25. verschwindet. Die Institutionen werden als naturgegebene, unhinterfragbare und nicht 
  26. ver&#x00E4;nderbare faktische Gegebenheiten angesehen, als kollektiv geteilte 
  27. Wissensbest&#x00E4;nde. Die Autorit&#x00E4;t der Institution an sich, die sich aus ihrer 
  28. historisch bedingten Faktizit&#x00E4;t ergibt, sowie die Autorit&#x00E4;t der 
  29. Bezugspersonen, die gesellschaftliche Institutionen, Normen und Verhaltensweisen 
  30. &#x00FC;bermitteln, f&#x00FC;hren dabei zu 
  31. einem regelkonformen Handeln der <a sdj="asdas"><sup>saddfsdfsad</sup></a> Nachkommen (Berger/Luckmann <sup>21</sup>2007, 62&#x2013;72).
  32.  
Outputs

Expand|Select|Wrap|Line Numbers
  1. Matching = 'regelkonformen Handeln der <a sdj="asdas"><sup>saddfsdfsad</sup></a> Nachkommen (Berger/Luckmann <sup>21</sup>2007, 62&#x2013;72).'
  2.  
- Miller
May 19 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: VinayKumarParakoti | last post by:
Hi all, I am new to this site and this is my first post. But this issue is of high priority. I am trying to print pdf file in browser using perl script. Onclick on hyperlink a child window...
6
by: atinti | last post by:
I'm tyring to write something that will send a simple email using Perl so far this is what I have #!/usr/bin/perl -w use strict; my $executable = "saplotus.exe'; my $server =...
4
by: bashetty | last post by:
Well its a strange problem i have, some of you might already faced it and have a solution. I have to maintain a set of unique "search key words" in meta tags for each content page in my site. With...
4
by: Npreeti | last post by:
HI , I want to copy a file from one machine to another machine using perl. Also i want to know whether i can past arguments to perl program?
6
by: sainiamit25 | last post by:
Hi, I want to parse a file and from some of the attributes of this file, i want to create another file using perl. Can anybody suggest me a way out? It would be great if i dont have to use any...
3
by: Max58kl | last post by:
Trying to access data and print it to the screen using Perl Builders I/O Window -------------------------------------------------------------------------------- Hi I am using a program called...
1
by: jawas | last post by:
Can any body help to write the general Perl script to transfer file from one window XP machine to another window XP machine and then change the file name and send some command for e.g config, 9,9 to...
3
by: zaxxon25 | last post by:
I am having an issue with attaching 2 attachments one xip and other excel file with email and sending using perl sendmail. I tried to look on various forums and everywhere i get advice using MIME ::...
3
by: hanz | last post by:
Hello everyone, I am trying to create an MS Access file using Perl in a Linux environment. By the way I am on a SuSE Linux envrironment. I have already installed the DBI module. I am looking...
0
by: Anuja T | last post by:
Hi, I am dealing with running macros through perl. i have following script to do the same which is working fine.Now what i have to do is to make one .xlsm (macro-enabled file)which will...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.