Page 1 of 1

Re: How to converting this data?

Posted: Thu Jul 31, 2008 7:48 am
by DataMystic Support
Try this perl pattern:
\[(\w+)\]([^\]]*)\[/\1\]

Replace with
$2|

Re: How to convert this data?

Posted: Thu Jul 31, 2008 8:17 am
by Fixer
============SIMPLE DATA BEGIN============
aaa|ccc|eee|fff|ggg|
============SIMPLE DATA END==============

OK but... where is my parameter "B" and "D"?

I'll would like to have this...
============SIMPLE DATA BEGIN============
aaa||ccc||eee|fff|ggg
============SIMPLE DATA END==============

I have this right now, it is possible to optimize that filters some how? Because I wrote some kind of crazy method right now I thing :P

Code: Select all

TextPipe 

Filter Title: D:\dokumenty\FILTRY\przyklad_luki.fll

Filter List
-----------
Filter options
|  [ ] Log to file
|  [X] Append to logfile
|  Log filename: textpipe.log
|  Threshold 500
|
|--Input from file(s)
|     [ ] Confirm before processing each file
|     [ ] Confirm before processing read/only files
|     [ ] Delete input files after processing
|     Process binary files
|   
|--Comment...
|  |  TEST
|  |
|  +--Perl pattern [^============SIMPLE DATA BEGIN============(.*)============SIMPLE DATA END============] with [$1]
|     |  [ ] Match case
|     |  [ ] Whole words only
|     |  [ ] Case sensitive replace
|     |  [ ] Prompt on replace
|     |  [ ] Skip prompt if identical
|     |  [ ] First only
|     |  [ ] Extract matches
|     |  Maximum text buffer size 4096
|     |  [ ] Maximum match (greedy)
|     |  [ ] Allow comments
|     |  [X] '.' matches newline
|     |  [X] UTF-8 Support
|     |
|     +--Convert End of Lines - Auto to None
|           [X] Remove bad EOL
|         
|--Comment...
|  |  We fill the missing gaps (PSEUDO TAGS)
|  |  
|  |  [/END_PSEUDO_TAG]
|  |  (insert missing pseudo tag)
|  |  [BEGIN_PSEUDO_TAG]
|  |
|  +--Perl pattern [(\[/a\]\[something_c\]|\[/something_c\]\[e\])] with [||]
|        [ ] Match case
|        [ ] Whole words only
|        [ ] Case sensitive replace
|        [ ] Prompt on replace
|        [ ] Skip prompt if identical
|        [ ] First only
|        [ ] Extract matches
|        Maximum text buffer size 4096
|        [ ] Maximum match (greedy)
|        [ ] Allow comments
|        [X] '.' matches newline
|        [X] UTF-8 Support
|      
|--Comment...
|  |  Clean TAGS
|  |
|  |--Perl pattern [\[(b|c|something_c|d|e|f|more_f|g)\]] with [|]
|  |     [ ] Match case
|  |     [ ] Whole words only
|  |     [ ] Case sensitive replace
|  |     [ ] Prompt on replace
|  |     [ ] Skip prompt if identical
|  |     [ ] First only
|  |     [ ] Extract matches
|  |     Maximum text buffer size 4096
|  |     [ ] Maximum match (greedy)
|  |     [ ] Allow comments
|  |     [X] '.' matches newline
|  |     [X] UTF-8 Support
|  |   
|  |--Perl pattern [\[/\w+\]] with []
|  |     [ ] Match case
|  |     [ ] Whole words only
|  |     [ ] Case sensitive replace
|  |     [ ] Prompt on replace
|  |     [ ] Skip prompt if identical
|  |     [ ] First only
|  |     [ ] Extract matches
|  |     Maximum text buffer size 4096
|  |     [ ] Maximum match (greedy)
|  |     [ ] Allow comments
|  |     [X] '.' matches newline
|  |     [X] UTF-8 Support
|  |   
|  +--Replace [[a]] with []
|        [ ] Match case
|        [ ] Whole words only
|        [ ] Case sensitive replace
|        [ ] Prompt on replace
|        [ ] Skip prompt if identical
|        [ ] First only
|        [ ] Extract matches
|      
+--Output to file(s)
      [ ] Only update date on changed files
      [X] Keep original file's date and time
      [ ] Append mode
      [ ] Change extension to: .txt
    Backup mode    

Files List
----------
Download this example: http://plikojad.pl/bbl3izxt0ipw

Re: How to converting this data?

Posted: Thu Jul 31, 2008 10:42 am
by DataMystic Support
Sorry, make the perl pattern:
\[(\w+)\]([^\]]*)\[/\1\]\r\n

If you need to add a newline after the ggg field, search for '|====' and add in a newline.

What do you mean by 'parameter "B" and "D"?' You didn't provide one.

This filter:

Code: Select all

|--Perl pattern [\[(\w+)\]([^\]]*)\[/\1\]\r\n] with [$2|]
|     [ ] Match case
|     [ ] Whole words only
|     [ ] Case sensitive replace
|     [X] Prompt on replace
|     [ ] Skip prompt if identical
|     [ ] First only
|     [ ] Extract matches
|     Maximum text buffer size 4096
|     [ ] Maximum match (greedy)
|     [ ] Allow comments
|     [X] '.' matches newline
|     [ ] UTF-8 Support
Takes this:

Code: Select all

============SIMPLE DATA BEGIN============
[a]aaa[/a]
[something_c]ccc[/something_c]
[e]eee[/e]
[more_f]fff[/more_f]
[g]ggg[/g]
============SIMPLE DATA END============
and converts it to this:

Code: Select all

============SIMPLE DATA BEGIN============
aaa|ccc|eee|fff|ggg|============SIMPLE DATA END============

Re: How to convert this data?

Posted: Thu Jul 31, 2008 11:32 am
by Fixer
DataMystic Support wrote: What do you mean by 'parameter "B" and "D"?' You didn't provide one.
oh sorry... my mistake I did not explain

Ok so maby i explain whith other more real example:
============SIMPLE FILM_1 BEGIN============
[title]some title 1[/title]
[alternative_title]some alternative title 1[/alternative_title]
[director]some director 1[/director]
============SIMPLE FILM_1 END============

============SIMPLE FILM_2 BEGIN============
[title]some title 2[/title]
[director]some director 2[/director]
============SIMPLE FILM_2 END============

And "the end" rezult:
============SIMPLE FILM_1 BEGIN============
some title 1|some alternative title 1|some director 1
============SIMPLE FILM_1 END============

============SIMPLE FILM_1 BEGIN============
some title 2||some director 2
============SIMPLE FILM_1 END============

As we see some times "film data" don't have "alternative_title" column.
In database I have 3 columns so i need some like this "||" (this is the blanc parameter "B")
I hope that you know about what I speak :D

PS I am pleased very much, that you want you to help me. :lol:

Re: How to convert this data?

Posted: Thu Jul 31, 2008 3:21 pm
by DataMystic Support
Then use an EasyPattern (not perl pattern) like this:

Code: Select all

[ 
'[title]', capture(1+ chars), '[/title]', 0+ chars, 
longest optional( '[alternative_title]', capture(1+ chars), '[/alternative_title]', 0+ chars, )
'[director]', capture(1+ chars), '[/director]'
]

Re: How to convert this data?

Posted: Thu Jul 31, 2008 7:34 pm
by Fixer
first I have little problem with implementation but now its works good

THX :D

Re: How to convert this data?

Posted: Thu Jul 31, 2008 8:41 pm
by DataMystic Support
Great - will you be purchasing soon?

Re: How to convert this data?

Posted: Thu Jul 31, 2008 9:22 pm
by Fixer
I wonder over this, I testing right now TextPipe Trial...
Yours application and help support are great.

Re: How to convert this data?

Posted: Thu Jul 31, 2008 10:56 pm
by DataMystic Support
Thank you!

Re: How to convert this data?

Posted: Tue Feb 01, 2011 6:15 pm
by DataMystic Support
Where are parameters B and D? What perl pattern did you try?