spaces

How replace all spaces inside HTML elements with   using preg_replace?

三世轮回 提交于 2019-12-17 20:24:25
问题 I need replace spaces with   inside HTML elements. Example: <table atrr="zxzx"><tr> <td>adfa a adfadfaf></td><td><br /> dfa dfa</td> </tr></table> should become <table atrr="zxzx"><tr> <td>adfa a   adfadfaf></td><td><br /> dfa  dfa</td> </tr></table> 回答1: use regex to catch data between tags (?:<\/?\w+)(?:\s+\w+(?:\s*=\s*(?:\".*?\"|'.*?'|[^'\">\s]+)?)+\s*|\s*)\/?>([^<]*)? then replace ' ' with ' ' also to catch before and after html : ^([^<>]*)<? >([^<>]*)$ Edit: here you go.... <?php $data=

Listing files in date order with spaces in filenames

ぐ巨炮叔叔 提交于 2019-12-17 20:16:40
问题 I am starting with a file containing a list of hundreds of files (full paths) in a random order. I would like to list the details of the ten latest files in that list. This is my naive attempt: $ ls -las -t `cat list-of-files.txt` | head -10 That works, so long as none of the files have spaces in, but fails if they do as those files are split up at the spaces and treated as separate files. File "hello world" gives me: ls: hello: No such file or directory ls: world: No such file or directory I

How do you recursively unzip archives in a directory and its subdirectories from the Unix command-line?

梦想的初衷 提交于 2019-12-17 17:33:12
问题 The unzip command doesn't have an option for recursively unzipping archives. If I have the following directory structure and archives: /Mother/Loving.zip /Scurvy/Sea Dogs.zip /Scurvy/Cures/Limes.zip And I want to unzip all of the archives into directories with the same name as each archive: /Mother/Loving/1.txt /Mother/Loving.zip /Scurvy/Sea Dogs/2.txt /Scurvy/Sea Dogs.zip /Scurvy/Cures/Limes/3.txt /Scurvy/Cures/Limes.zip What command or commands would I issue? It's important that this doesn

OSX Lion AppleScript : How to get current space # from mission control?

我只是一个虾纸丫 提交于 2019-12-17 17:24:47
问题 I'm trying to figure out how to get the current space # from mission control. Source would be helpful, but more helpful would be info on how to figure this out myself. I've written a few applescripts, but more often than not it seems like any time I need to do something new (that I can't find dictionary documentation for) it falls under the category of "tell this specific app (e.g. "System Events") this very specific thing" and I've no clue how I would actually figure that out. Specifically

Remove unicode characters from textfiles - sed , other bash/shell methods

允我心安 提交于 2019-12-17 03:39:38
问题 How do I remove unicode characters from a bunch of text files on the terminal? I've tried this but it didn't work: sed 'g/\u'U+200E'//' -i *.txt I need to remove these unicodes from the textfiles U+0091 - sort of weird "control" space U+0092 - same sort of weird "control" space A0 - non-space break U+200E - left to right mark 回答1: If you want to remove ONLY particular characters and you have python, you can: CHARS=$(python -c 'print u"\u0091\u0092\u00a0\u200E".encode("utf8")') sed 's/['"

XSL replace space with caret

你。 提交于 2019-12-14 03:55:07
问题 UPDATED CODE: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="no"/> <!-- overwritten by application with actual values --> <xsl:param name="calling" select="'SAMPLE_MOD'"/> <xsl:param name="called" select="'SERVER1'"/> <xsl:param name="date" select="'20051206'"/> <xsl:param name="time" select="'115600.000'"/> <xsl:param name="PatName" select="attr[@tag='00100010']"/> <xsl:template match="

How to check that excel cell value has spaces… excel 2007

人盡茶涼 提交于 2019-12-14 02:17:46
问题 I have an Excel file that contains some values. I need to check if a cell value contains spaces. For example, sometimes a user will write some values in the cell but mistakenly press Enter or Space in the cell. I want to see if the cell value has spaces inside... Please tell me how to do this. Thanks 回答1: Let's say I type "ABC " in cell A1 (ABC followed by a space). Either of these formulas should help: =LEN(A1)=LEN(TRIM(A1)) =EXACT(A1,TRIM(A1)) For a VBA version: Function HasSpaces(rng As

c++ spaces in operators , what are the rules

↘锁芯ラ 提交于 2019-12-13 13:52:58
问题 Does spaces have any meaning in these expressions: assume: int a = 1; int b = 2; 1) int c = a++ +b; Or, 2) int c = a+ ++b; When I run these two in visual studio, I get different results. Is that the correct behavior, and what does the spec says? In general, what should be evaluated first, post-increment or pre-increment? Edit: I should say that c =a+++b; Does not compile on visual studio. But I think it should. The postfix++ seems to be evaluated first. 回答1: Is that the correct behavior Yes,

How can I read a string with spaces in it in C?

元气小坏坏 提交于 2019-12-13 11:50:36
问题 scanf("%s",str) won't do it. It will stop reading at the first space. gets(str) doesn't work either when the string is large. Any ideas? 回答1: use fgets with STDIN as the file stream. Then you can specify the amount of data you want to read and where to put it. 回答2: char str[100]; Try this scanf("%[^\n]s",str); or this fgets(str, sizeof str, stdin)) 回答3: Create your own function to read a line. Here's what you basically have to do: 1. fgets into allocated (growable) memory 2. if it was a full

in java my file paths with included spaces show up as %20 and i'm not sure why

ⅰ亾dé卋堺 提交于 2019-12-13 07:54:10
问题 I have a photo selection model, but for some reason whenever I call the path of the images, the space in the path is converted to it's HTML code and I'm not sure why. Do any of you have any ideas? Thanks for any help you can spare. 回答1: It's url encoded. I dont know the java library to un-encode but I'm sure it's out there and fairly easy to use. edit - http://download.oracle.com/javase/1.4.2/docs/api/java/net/URLDecoder.html this maybe? 回答2: The specification for URLs (RFC 1738, Dec. '94)