Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hello, solocazzimiei and welcome to the Monastery. It is quite difficult to read your code in this post and it would help considerably if you could enclose each section of code within <code>...</code> tags.

While it is not entirely clear what you actually want here, you can use many techniques to separate a key from a value based upon the first colon. Since you are using a regex anyway, here is one such.

use strict; use warnings; use Test::More tests => 2; my $in = "NOTE;ENCODING=QUOTED-PRINTABLE:=0AAddress:=0A=0Aor. Soroca=0 +ARepublic of Moldova=0A=0A=0A=0A Footwear. =Children's footwear. Lady +'s footwear."; my $want_key = 'NOTE;ENCODING=QUOTED-PRINTABLE'; my $want_value = "=0AAddress:=0A=0Aor. Soroca=0ARepublic of Moldova=0A +=0A=0A=0A Footwear. =Children's footwear. Lady's footwear."; $in =~ /^([^:]+):(.*)/; is $1, $want_key, 'Key matches'; is $2, $want_value, 'Value matches';

Equally, you could use split or even index and substr to achieve the same end.


In reply to Re: .VCF records cleansing by hippo
in thread .VCF records cleansing by solocazzimiei

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-24 11:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found