取消
显示结果 
搜索替代 
您的意思是: 

remove whitespace

已解决!
转到解答

Ok, so I thought this would be simple.  I'm reading in an html file and just want to remove all whitespace.  I'm doing a search and replace on a space constant, tab constant and end on line constant and replacing with an empty string.  Replace all is set to true.  Simple right?  But it doesn't seem to work.  Any ideas?

 

Thanks in advance. 

Message Edited by dubs on 04-28-2010 05:31 PM
0 项奖励
1 条消息(共 13 条)
9,905 次查看

dubs,

 

It looks like you still need to search for linefeeds, "\n".  Try adding another search and replace function with a linefeed constant.

 

Chris M 

0 项奖励
2 条消息(共 13 条)
9,895 次查看
Line feeds and carriage returns should be included in the end of line constant...but even the search and replace on the space constant isn't working.
0 项奖励
3 条消息(共 13 条)
9,891 次查看

By changing the display mode to "\codes", I was able to determine that the spaces and tabs were being removed, but the newline was not being removed.  The raw html text displays newline as "\n".  I think the Labview newline is something like "\r\l" (carraige return & line feed).  This doesn't match \n so those were not removed.  By replacing the newline constant with a string constant, setting the constant to display \codes, and typing in \n, I was able to succesfully remove the newlines from the raw html text.  Try it yourself.

 

newline.png

 

- tbob

Inventor of the WORM Global
4 条消息(共 13 条)
9,881 次查看

dubs wrote:
Line feeds and carriage returns should be included in the end of line constant...but even the search and replace on the space constant isn't working.

 

It is working.  Newlines not being removed make it look like its not working.  Use \codes display to prove it is working.

 

 

Line feed and carriage return is not the same as newline.  carriage return = \r, newline = \n, not sure if line feed has a \code (maybe line feed is same as newline)

 

 

Message Edited by tbob on 04-28-2010 04:12 PM
Message Edited by tbob on 04-28-2010 04:13 PM
- tbob

Inventor of the WORM Global
0 项奖励
5 条消息(共 13 条)
9,878 次查看

hmm...I think I see my problem. 


The HTML file I'm trying to parse is coming from an Agilent ParBert and they have a bunch of special characters that aren't being included in the search and replace functions.  I’m seeing a bunch of \00 characters that I’m guessing lab view doesn’t count as whitespace...I didn't see them until I turned on the /codes display.  I think this gets me going in the right direction. 

Thanks for the /codes tip!

0 项奖励
6 条消息(共 13 条)
9,860 次查看

Thanks for all the help so far.

 

But I'm still having some issues...searching on a \00 code doesn't seem to work.  Reading through the regexp help I see that "\031 - Matches an octal character (31 octal in this case)"...could this be my problem and is there a way around it?

 

Attached is the data I'm actually dealing with.

0 项奖励
7 条消息(共 13 条)
9,846 次查看

dubs,

 

Make sure that the constant wired to the "search string" input is set to codes display.  Right now, you are searching for the string "\\00", instead of "\00".

 

Chris M 

0 项奖励
8 条消息(共 13 条)
9,842 次查看

That didn't help.  I think the search and replace function is looking for an octal number of "0" Since "\0" as a code is a flag for an octal search. The input string has "\00" which is not an octal representation of a number in my data. 

 

Is there any way to faltten the string from the code display and just do a strict search and replace with ignoring all codes?

Message Edited by dubs on 04-29-2010 11:09 AM
0 项奖励
9 条消息(共 13 条)
9,794 次查看
解答
接受人 dubs

Hi dubs,

 

your search string is not configured to display in \codes! Change to \codes and remove the second \, then the replace will work...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 项奖励
10 条消息(共 13 条)
9,781 次查看