Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to find some special strings in my text and then delete other strings.

For example in this sentence:

( (IP-MAT (CONJ vnnd)
      (NP-NOM (D das) (N wort))
      (BED war)
      (PP (P bey)
          (CODE [2])
          (NP-DAT (NPR Gott)))
      (. ,))

I want to regularly keep: CONJ D N BED P NPR. and delete other strings in this text.

Second example:

( (IP-MAT-SPE (NP-NOM-LFD (D diser) (NPR Jhesus)
 (, ,)
 (CP-REL-SPE (WNP-1 (WPRO wilcher)) (C 0)
 (IP-SUB-SPE (NP-NOM T-1) (PP (P von) (NP-DAT (PRO euch))) (BEPI ist) (RP auff) (VAN genomen) (PP (P gen) 
 (NP-ACC-XXX (NPR hymel)))))) 
 (, ,) 
 (NP-NOM-RSP (D der)) (RDPI wirt) (VB komen)
(PP (P wie) (CP-ADV-SPE (C 0) (IP-SUB-SPE (NP-NOM (PRO yhr)) (NP-ACC-2 (PRO yhn)) (VBN gesehen) (HVPI habt) 
(IP-INF-SPE (NP-ACC-SBJ ICH-2) (PP (P gen)
(NP-ACC-XXX (NPR hymel))) (VB faren)))))
 (. .)) 

and I want to change them to this :

D NPR , WPRO C NP-NOM P PRO BEPI RP VAN P NPR , D RDPI VB , P C PRO PRO VBN HVPI NP-ACC-SBJ P NPR VB . –
share|improve this question
    
What would you like the result to look like? Please edit this question and provide an example result. –  Kevin Panko Oct 2 '13 at 17:25
    
Jerry edited it. This example is about Corpora that we want to normalize them. It is not related to computer subject. But Our end is separate some strings and delete others. –  user259288 Oct 2 '13 at 17:31
1  
@user259288 You can edit it back if you want. If I understand correctly, you just want to get CONJ D N BED P NPR on a single line, right? –  Jerry Oct 2 '13 at 17:35
1  
@Jerry Yes exactly. –  user259288 Oct 2 '13 at 17:36
    
@user259288 Do you have more examples perhaps? Just in case there's one solution which works only for what you've provided and not your full file. If possible, try to get one which is very different from what you have currently in your question. –  Jerry Oct 2 '13 at 17:51

1 Answer 1

up vote 0 down vote accepted

Welp, sounds like you can do something like this:

Find:

(?:(?!\n\n).(?<!\n\n))*?\(([\w,.-]+)\s+[\w,.-]+\)+|(?:(?!\n\n).(?<!\n\n))+$

Replace with:

$1 

[Dollar, then "1", then space]

regex101 demo

Try to get one of the latest notepad++ versions if this doesn't work and make sure you checked 'regular expressions' in the Search&Replace dialog box and checked '. match newlines'.

share|improve this answer
    
    
@nixda Hmm, I would rather not. It will make the . match those replaced strings and this would prevent keeping the 'paragraphs' (if I can call them like that) separate. Interesting answer you had there though :) –  Jerry Oct 2 '13 at 19:08
    
@Jerry Unfortunately it doesn't work. –  user259288 Oct 2 '13 at 19:10
    
@user259288 What happens exactly? Nothing, error, or wrong replace? –  Jerry Oct 2 '13 at 19:11
    
@Jerry Oh..sorry I forgot space. It works! Thank you Jerry.I'm so surprised :) –  user259288 Oct 2 '13 at 19:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.