2

Say I have over 200 of these,

(17, 'BH', 'BAHRAIN', 'Bahrain', 'BHR', 48, 973),

Is there a way I to remove, everything except 'Bahrain' and 973, besides going through them one by one?

5
  • Do you want to keep both cases of Bahrain?
    – Bohemian
    Aug 20, 2015 at 9:56
  • Is it always bahrain and 973 in the 200 cases, or is this more a "keep data at position 4 and 7" problem?
    – kl78
    Aug 20, 2015 at 9:59
  • @Bohemian, No just Titlecase Bahrain.
    – AndroidAL
    Aug 20, 2015 at 10:02
  • @kl78,No its different country and areacodes, so it will be keep data in position 4 and 7.
    – AndroidAL
    Aug 20, 2015 at 10:03
  • Maybe you can have a look here: stackoverflow.com/questions/19449492/…
    – kl78
    Aug 20, 2015 at 10:18

1 Answer 1

2

You can use capturing groups

Find What: \(.*,.*,.*,(.*),.*,.*,(.*)\)

Replace With: (\1,\2)
2
  • Thanks, what will (\1,\2) do?
    – AndroidAL
    Aug 20, 2015 at 11:20
  • \1 is the first capturing group (4th position) and \2 is the second capturing group (7th position). Each capturing group appears in regular expression in parentheses
    – dimcookies
    Aug 20, 2015 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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