Question: i have some files and folder in my git repo. But some of them have a very long path that when i try to synchronize my workspace with git it gives me an error because windows cannot have characters in a path more than 260. Is there a way to pull specific files and folders? for example `*.php` files from `/file/*.php`?

I do not know much from git and also all other tutorials and answers i found here do not work. i even tried the `git git_core.longpathenabled true` but nothing happened.

Any ideas?

Answer: 
Another option, using [`CHARINDEX`](https://msdn.microsoft.com/en-us/library/ms186323(v=sql.90).aspx), [`REPLACE`](https://msdn.microsoft.com/en-us/library/ms186862(v=sql.90).aspx) and [`SUBSTRING`](https://msdn.microsoft.com/en-us/library/ms187748(v=sql.90).aspx):

```
DECLARE @OriginalString varchar(50) = 'a|b^c^d^e|f|g'

DECLARE @MyString varchar(50) = @OriginalString 

WHILE CHARINDEX('^', @MyString) > 0 
BEGIN
    SELECT @MyString = REPLACE(@MyString, 
                               SUBSTRING(@MyString, 
                                         CHARINDEX('^', @MyString), 
                                         CASE WHEN CHARINDEX('|', @MyString, CHARINDEX('^', @MyString)) > 0 THEN
                                            CHARINDEX('|', @MyString, CHARINDEX('^', @MyString)) - CHARINDEX('^', @MyString)
                                         ELSE
                                            LEN(@MyString)
                                         END
                                         )
                       , '')
END

SELECT @OriginalString As Original, @MyString As Final

```

Output:

```
Original              Final
a|b^c^d^e|f|g         a|b|f|g

```
This expression will replace the first instance of caret up to the subsequent pipe (or end of string.) You can just run a loop until no more rows are updated or no more carets are found inside the function, etc.

```
case
    when charindex('^', s) > 0
    then stuff(
             s,
             charindex('^', s),
             charindex('|', s + '|', charindex('^', s) + 1) - charindex('^', s),
             ''
         )
    else s
end

```

Here's a loop you can adapt for a function definition:

```
declare @s varchar(30) = 'a|b^c^d|e|f^g|h^i';
declare @n int = charindex('^', @s);

while @n > 0
begin
    set @s = stuff(@s, @n, charindex('|', @s + '|', @n + 1) - @n, '');
    set @n = charindex('^', @s, @n + 1);
end
select @s;

```

A little bit of care needs to be taken for the trailing of the string where there won't be a final pipe separator. You can see I've handled that.