Cita:
Iniciado por zerokilled ohhhhh cierto, error mio!
lo copie mal de la prueba que habia hecho... dentro de los corchetes y al final, agrega \s.
Que tal,, oye tengo una duda, yo pongo:
campoTextArea = campoTextArea.replace(/\s(?=\d)/g, ',');
campoTextArea = campoTextArea.replace(/[a-z\xc0-\xff\s]+/gi, "'$&'");
El contenido:
Aceite de cacahuete 100 0.4 878 0.0 0.0 99.4 13.0 53.0 24.6 1 0.0 0 0 0 0 0 0.06
Aceite de coco 100 0.0 884 0.0 0.0 100.0 **.* 5.8 1.8 0 0.0 2 2 0 2 1 0.04
Aceite de germen de trigo 100 0.0 879 0.0 0.0 99.5 17.2 15.7 64.7 0 0.0 0 0 0 0 0
El resultado:
Código PHP:
'Aceite de cacahuete',100,0.4,878,0.0,0.0,99.4,13.0,53.0,24.6,1,0.0,0,0,0,0,0,0.06'
Aceite de coco',100,0.0,884,0.0,0.0,100.0' '**.*,5.8,1.8,0,0.0,2,2,0,2,1,0.04'
Aceite de germen de trigo',100,0.0,879,0.0,0.0,99.5,17.2,15.7,64.7,0,0.0,0,0,0,0,0,0.00'
Aceite de girasol',100,0.2,882,0.0,0.0,99.8,11.0,22.4,60.7,2,0.0,0,0,0,0,0,0.03
El resultado deseado:
'Aceite de cacahuete',100,0.4,878,0.0,0.0,99.4,13.0,53.0,24.6 ,1,0.0,0,0,0,0,0,0.06
|
'Aceite de coco',100,0.0,884,0.0,0.0,100.0' '**.*,5.8,1.8,0,0.0,2,2,0,2,1,0.04
|
'Aceite de germen de trigo',100,0.0,879,0.0,0.0,99.5,17.2,15.7,64.7,0,0 .0,0,0,0,0,0,0.00
No se si sean los saltos de linea... que ocacione eso..
Como pudo hacer para que cada final de la sentencia me ponga un pipe
|
??
Muchas,gracias