2014-01-29 3 views
0

줄 바꿈으로 6 번째 쉼표를 모두 바꾸려고합니다. {6}을 행운과 함께 텍스트 패드에서 \ n으로 바꾸려고했습니다. 어떤 아이디어?6 번째 쉼표를 줄 바꾸기로 바꾸는 정규식

+0

참고로, 정규식 당신이 연속 경기 6 개 쉼표를 시도했다. – Vache

+0

정규식을 만들 때 [this tool] (http://rick.measham.id.au/paste/explain.pl)을 사용하여 정규식을 테스트 해보십시오. – csmckelvey

+0

답장을 보내 주셔서 감사합니다. h2oooooo,이 응용 프로그램에서 어떤 응용 프로그램을 사용하고 있습니까? 나는 그것이 텍스트 패드를 위해 너무 복잡하다고 생각한다. –

답변

2

/^(([^\n,]+,){5}[^\n,]+),\s*/gm 대체품 \1\n은 맛에 따라 정상적으로 작동합니다.

/^((.*?,){5}.*?),\s*/gm도 제대로 작동하지만 DOTALL 수식어를 사용할 수 없습니다.

입력 :

this, is, my, string, and, it, is, very, nice, and, pretty, cool 
this, is, my, string, and, it, is, very, nice, and, pretty, cool 
this, is, my, string, and, it, is, very, nice, and, pretty, cool 
this, is, my, string, and, it, is, very, nice, and, pretty, cool 
this, is, my, string, and, it, is, very, nice, and, pretty, cool¨ 

출력 :

this, is, my, string, and, it 
is, very, nice, and, pretty, cool 
this, is, my, string, and, it 
is, very, nice, and, pretty, cool 
this, is, my, string, and, it 
is, very, nice, and, pretty, cool 
this, is, my, string, and, it 
is, very, nice, and, pretty, cool 
this, is, my, string, and, it 
is, very, nice, and, pretty, cool 

DEMO

+0

어떤 프로그램을 사용하고 있습니까? 이것은 텍스트 패드에서 작동하지 않는 것 같습니다. 텍스트는 다음과 같이 정렬됩니다 : G1/1, G1/2, G1/3 등 ... 공백으로 버릴 것입니까? –

관련 문제