Hi there,

TLDR:

How do I remove everything that comes after the , ?

I need help with removing text after the comma.

Input:
12263, Armadyl crozier
12265, Bandos robe top
12267, Bandos robe legs
12269, Bandos stole
12271, Bandos mitre
12273, Bandos cloak
12275, Bandos crozier
12277, Mithril platebody (g)

Output:
12263, 12265, etc...

I tried didn't give me the output i wanted because well you know:

Code:
try {
	    	Path path = Paths.get(SignLink.findcachedir() + "items.txt");
	    	Charset charset = StandardCharsets.UTF_8;

	    	String content = new String(Files.readAllBytes(path), charset);
			content = content.replaceAll("[^0-9]", "");
	    	Files.write(path, content.getBytes(charset));
		} catch (IOException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
also removes the comma

Can someone more experienced help me?

Edited: I replaced the : with comma first.

Ok I got my output using:

Code:
try {
	    	Path path = Paths.get(SignLink.findcachedir() + "items.txt");
	    	Charset charset = StandardCharsets.UTF_8;

	    	String content = new String(Files.readAllBytes(path), charset);
			content = content.replaceAll("[^,0-9]", "");
	    	Files.write(path, content.getBytes(charset));
		} catch (IOException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
This results in:

Code:
91,93,95,97,99,101,103,105,107,109,111,113,4115,3117,2119,1121,3123,2125,1127,3129,2131,1133,3135,2137,1139,3141,2143,1145,3147,2149,1151,3153,2155,1157,3159,2161,1163,3165,2167,1169,3171,2173,1175,3177,2179,1181,3183,2185,1187,189,3191,2193,148,50,52,53,54,56,58,60,62,64,66,68,70,72,39,40,41,42,43,44,45,46,199,201,203,205,207,209,211,213,215,217,219,221,223,225,227,229,231,233,235,237,239,241,243,245,247,249,251,253,255,257,259,261,263,265,267,269,301,303,305,307,309,311,313,314,315,317,319,321,325,327,329,331,333,335,337,338,339,341,345,347,349,351,353,355,359,361,363,365,371,373,377,379,383,385,389,391,395,397,434,436,438,440,442,444,446,447,449,451,453,526,530,532,542,544,554,555,556,557,558,559,560,561,562,563,564,565,566,590,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,839,841,843,845,847,849,851,853,855,857,859,861,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,946,952,1065,1067,1069,1071,1073,1075,1077,1079,1081,1083,1085,1087,1089,1091,1093,1095,1097,1099,1101,1103,1105,1107,1109,1111,1113,1115,1117,1119,1121,1123,1125,1127,1129,1131,1133,1135,1137,1139,1141,1143,1145,1147,1149,1151,1153,1155,1157,1159,1161,1163,1165,1167,1169,1171,1173,1175,1177,1179,1181,1183,1185,1187,1189,1191,1193,1195,1197,1199,1201,1203,1205,1207,1209,1211,1213,1215,1217,1219,1221,1223,1225,1227,1229,1231,1233,1235,1237,1239,1241,1243,1245,1247,1251,1253,1255,1257,1259,1261,1265,1267,1269,1271,1273,1275,1277,1279,1281,1283,1285,1287,1289,1291,1293,1295,1297,1299,1301,1303,1305,1307,21309,21311,21313,21315,21317,21319,21321,1323,1325,1327,1329,1331,1333,1335,1337,1339,1341,1343,1345,1347,1349,1351,1353,1355,1357,1359,1361,1363,1365,1367,1369,1371,1373,1375,1377,1379,1381,1383,1385,1387,1389,1391,1393,1395,1397,1399,1401,1403,1405,1407,1420,1422,1424,1426,1428,1430,1432,1434,1436,1438,1440,1442,1444,1446,1448,1452,1454,1456,1458,1462,1511,1513,1515,1517,1519,1521,1523,1592,1594,1595,1597,1599,1601,1603,1605,1607,1609,1611,1613,1615,1617,1619,1621,1623,1625,1627,1629,1631,1704,1706,11708,21710,31712,41725,1727,1729,1731,1733,1734,1741,1743,1745,1747,1749,1751,1753,2347,2349,2351,2353,2355,2357,2359,2361,2363,2412,2413,2414,2415,2416,2417,2428,42430,42432,42434,42436,42438,42440,42442,42444,42446,42448,42450,42452,42454,32456,22458,12481,2483,2485,2487,2489,2491,2493,2495,2497,2499,2501,2503,2505,2507,2509,2583,2585,2587,2589,2591,2593,2595,2597,2599,2601,2603,2605,2607,2609,2611,2613,2615,2617,2619,2621,2623,2625,2627,2629,2631,2633,2635,2637,2639,2641,2643,2645,2647,2649,2651,2653,2655,2657,2659,2661,2663,2665,2667,2669,2671,2673,2675,2978,2979,2980,2981,2982,2983,2984,2985,2986,2987,2988,2989,2990,2991,2992,2993,2994,2995,2998,3000,3002,3004,3008,43010,33012,23014,13016,43018,33020,23022,13024,43026,33028,23030,13032,43034,33036,23038,13040,43042,33044,23046,13049,3051,3057,3058,3059,3060,3061,3093,3094,3095,3096,3097,3098,3099,3100,3101,3122,3190,3192,3194,3196,3198,3200,3202,3385,3387,3389,3391,3393,3472,3473,3474,3475,3476,3477,3478,3479,3480,3481,3483,3485,3486,3488,3749,3751,3753,3755,3840,3842,3844,4087,4089,4091,4093,4095,4097,4099,4101,4103,4105,4107,4109,4111,4113,4115,4117,4119,4121,4123,4125,4127,4129,4131,4170,4315,14317,24319,34321,44323,54325,64327,74329,84331,94333,104335,114337,124339,134341,144343,154345,164347,174349,184351,194353,204355,214357,224359,234361,244363,254365,264367,274369,284371,294373,304375,314377,324379,334381,344383,354385,364387,374389,384391,394393,404395,414397,424399,434401,444403,454405,464407,474409,484411,494413,504417,44419,34421,24423,14503,4504,4505,4506,4507,4508,4509,4510,4511,4512,4585,4587,5291,5292,5293,5294,5295,5296,5297,5298,5299,5300,5301,5302,5303,5304,5527,5529,5531,5533,5535,5537,5539,5541,5543,5545,5547,5553,5554,5555,5556,5557,5558,5616,5617,5618,5619,5620,5621,5622,5623,5624,5625,5626,5627,5628,5629,5630,5631,5632,5633,5634,5635,5636,5637,5638,5639,5640,5641,5642,5643,5644,5645,5646,5647,5648,5649,5650,5651,5652,5653,5654,5655,5656,5657,5658,5659,5660,5661,5662,5663,5664,5665,5666,5667,5668,5670,5672,5674,5676,5678,5680,5682,5684,5686,5688,5690,5692,5694,5696,5698,5700,5702,5704,5706,5708,5710,5712,5714,5718,5720,5722,5724,5726,5728,6106,6107,6108,6109,6110,6111,6128,6129,6130,6131,6133,6135,6137,6139,6141,6143,6145,6147,6149,6151,6153,6322,6324,6326,6328,6330,6522,6523,6524,6525,6526,6527,6528,6568,6685,46687,36689,26691,17060,7332,17334,17336,17338,27340,27342,27344,37346,37348,37350,47352,47354,47356,57358,57360,57362,7364,7366,7368,7370,7372,7374,7376,7378,7380,7382,7384,7386,7388,7390,7392,7394,7396,7398,7399,7400,7454,7455,7456,7457,7458,7459,7460,7461,7944,7946,8007,8008,8009,8010,8011,8012,8013,8880,8882,9068,9069,9070,9071,9072,9073,9074,9075,9096,9097,9098,9099,9100,9101,9102,9106,9140,9141,9142,9143,9144,9145,9174,9176,9177,9179,9181,9183,9185,9187,9188,9189,9190,9191,9192,9193,9194,9236,9237,9238,9239,9240,9241,9242,9243,9244,9245,9286,9287,9288,9289,9290,9291,9292,9293,9294,9295,9296,9297,9298,9299,9300,9301,9302,9303,9304,9305,9306,9335,9336,9337,9338,9339,9340,9341,9342,9375,9376,9377,9378,9379,9380,9381,9382,9420,9422,9423,9425,9427,9429,9431,9454,9456,9457,9459,9461,9463,9465,9672,9674,9676,9678,9739,49741,39743,29745,19747,9748,9749,9750,9751,9752,9753,9754,9755,9756,9757,9758,9759,9760,9761,9762,9763,9764,9765,9766,9767,9768,9769,9770,9771,9772,9773,9774,9775,9776,9777,9778,9779,9780,9781,9782,9783,9784,9785,9786,9787,9788,9789,9790,9791,9792,9793,9794,9795,9796,9797,9798,9799,9800,9801,9802,9803,9804,9805,9806,9807,9808,9809,9810,9811,9812,9813,9814,9948,9949,9950,9998,410000,310002,210004,110035,10037,10039,10041,10043,10045,10047,10049,10051,10069,10071,10073,10074,10077,10079,10081,10083,10085,10156,10158,10159,10354,410356,310358,210360,110362,10364,10366,10368,10370,10372,10374,10376,10378,10380,10382,10384,10386,10388,10390,10400,10402,10404,10406,10408,10410,10412,10414,10416,10418,10420,10422,10424,10426,10428,10430,10432,10434,10436,10438,10440,10442,10444,10446,10448,10450,10452,10454,10456,10458,10460,10462,10464,10466,10468,10470,10472,10474,10498,10499,10635,10639,10640,10641,10642,10643,10644,10645,10646,10647,10648,10649,10650,10651,10652,10653,10654,10655,10656,10657,10658,10659,10660,10661,10662,10663,10664,10665,110666,110667,110668,210669,210670,210671,310672,310673,310674,410675,410676,410677,510678,510679,510680,10681,10682,10683,10684,10685,10686,10687,10688,10690,10691,10692,10693,10694,10695,10697,10698,10699,110700,210701,310702,410703,510704,110705,210706,310707,410708,510709,110710,210711,310712,410713,510714,10715,10716,10717,10718,10719,10720,10721,10722,10723,10724,10725,10726,10727,10728,10729,10736,10738,10748,10750,10752,10754,10756,10758,10760,10762,10764,10766,10768,10770,10772,10774,10776,10778,10780,10782,10784,10786,10788,10790,10792,10794,10796,10798,10800,10802,10804,10806,10828,11212,11227,11228,11229,11976,511978,612193,12195,12197,12199,12201,12203,12205,12207,12209,12211,12213,12215,12217,12219,12221,12223,12225,12227,12229,12231,12233,12235,12237,12239,12241,12243,12245,12247,12249,12251,12253,12255,12257,12259,12261,12263,12265,12267,12269,12271,12273,12275,12277,12279,12281,12283,12285,12287,12289,12291,12293,12295,12297,12299,12301,12303,12305,12307,12309,12311,12313,12315,12317,12319,12321,12323,12325,12327,12329,12331,12333,

However stuff such as:

6685, Saradomin brew(4)
6687, Saradomin brew(3)
6689, Saradomin brew(2)
6691, Saradomin brew(1)
7060, Tuna potato
7332, Black shield (h1)
7334, Adamant shield (h1)
7336, Rune shield (h1)
7338, Black shield (h2)
7340, Adamant shield (h2)
7342, Rune shield (h2)
7344, Black shield (h3)
7346, Adamant shield (h3)
7348, Rune shield (h3)
7350, Black shield (h4)
7352, Adamant shield (h4)

Gets all fucked up and becomes ",46687,36689,26691,17060"

Help is appreciated.

FIXED!! close topic.