[Question]
  [
This challenge takes place on a grid.
```
+----------+
|          |
|          |
|          |
|          |
|          |
|          |
|          |
|          |
|          |
+----------+
```
This one's 10 x 10, but it can be any rectangular shape.
There are four directions on this grid. Up, down, left and right.
The task is to draw a path starting with an upper case direction initial. In this example, will go directly upward from the U.
```
+----------+
|          |
|          |
|          |
|          |
|          |
|          |
|          |
|          |
|   U      |
+----------+
```
The path will go upwards and be comprised of full-stop characters (.), until it hits a wall, when it will terminate with an asterisk (\*).
```
+----------+
|   *      |
|   .      |
|   .      |
|   .      |
|   .      |
|   .      |
|   .      |
|   .      |
|   U      |
+----------+
```
In addition to path starts, there's also direction changers, represented by a lower case direction initial.
```
+----------+
|          |
|          |
|          |
|   r.....*|
|   .      |
|   .      |
|   .      |
|   .      |
|   U      |
+----------+
```
Also, an upper case X us an obstacle which will terminate the path.
```
+----------+
|          |
|          |
|          |
|          |
|   r...*X |
|   .      |
|   .      |
|   .      |
|   U      |
+----------+
```
---
# Rules
* The input is a string consisting of a frame, (consisting of |, - and + characters) containing characters denoting path starts, direction changers, and obstacles.
* Your code should add full stop characters to follow the path described by starts and direction changers, and an asterisk when/if the path meets a wall or obstacle.
* There can be multiple path starts.
* The code will still terminate without error if the path describes a loop.
* If a path meets a path start, it will act as a direction changer.
* It's code golf, low-byte code and no standard loopholes, please.
* I always prefer links to an on-line interpreter.
---
# Test Cases
## 1: Simple
```
+----------+
|          |
|          |
|          |
|          |
|          |
|          |
|          |
|          |
|   U      |
+----------+
+----------+
|   *      |
|   .      |
|   .      |
|   .      |
|   .      |
|   .      |
|   .      |
|   .      |
|   U      |
+----------+
```
## 2: Right turn
```
+----------+
|          |
|          |
|          |
|   r      |
|          |
|          |
|          |
|          |
|   U      |
+----------+
+----------+
|          |
|          |
|          |
|   r.....*|
|   .      |
|   .      |
|   .      |
|   .      |
|   U      |
+----------+
```
## 3: Crossroads
```
+----------+
|          |
|          |
|          |
|   r  d   |
|          |
| u    l   |
|          |
|          |
|   U      |
+----------+
+----------+
| *        |
| .        |
| .        |
| . r..d   |
| . .  .   |
| u....l   |
|   .      |
|   .      |
|   U      |
+----------+
```
## 4: 4 Crossing paths
```
+----------+
|      D   |
|          |
|          |
|R         |
|          |
|         L|
|          |
|          |
|   U      |
+----------+
+----------+
|   *  D   |
|   .  .   |
|   .  .   |
|R........*|
|   .  .   |
|*........L|
|   .  .   |
|   .  .   |
|   U  *   |
+----------+
```
## 5: First Loop
```
+----------+
|          |
|          |
|          |
|   r  d   |
|          |
|   u  l   |
|          |
|          |
|   U      |
+----------+
+----------+
|          |
|          |
|          |
|   r..d   |
|   .  .   |
|   u..l   |
|   .      |
|   .      |
|   U      |
+----------+
```
## 6: Starter as changer
```
+----------+
|          |
|          |
|          |
|   L      |
|          |
|          |
|          |
|          |
|   U      |
+----------+
+----------+
|          |
|          |
|          |
|*..L      |
|   .      |
|   .      |
|   .      |
|   .      |
|   U      |
+----------+
```
## 7: Straight Loop
```
+----------+
|          |
|          |
|          |
|          |
|   r  l   |
|          |
|          |
|          |
|   U      |
+----------+
+----------+
|          |
|          |
|          |
|          |
|   r..l   |
|   .      |
|   .      |
|   .      |
|   U      |
+----------+
```
## 8: Tight Knot
```
+----------+
|          |
|          |
|          |
|  d  l    |
|   r u    |
|  r u     |
|          |
|          |
|   U      |
+----------+
+----------+
|    *     |
|    .     |
|    .     |
|  d..l    |
|  .r.u    |
|  r.u     |
|   .      |
|   .      |
|   U      |
+----------+
```
## 9: An Obstacle
```
+----------+
|          |
|          |
|          |
|          |
|   r    X |
|          |
|          |
|          |
|   U      |
+----------+
+----------+
|          |
|          |
|          |
|          |
|   r...*X |
|   .      |
|   .      |
|   .      |
|   U      |
+----------+ 
```
## 10: S Shape
```
+----------+
|r     d   |
|          |
|  XXXXXXXX|
| d      l |
|ul        |
|XXXXXXX   |
|          |
|R       u |
|          |
+----------+
+----------+
|r.....d   |
|.     *   |
|. XXXXXXXX|
|.d......l |
|ul      . |
|XXXXXXX . |
|        . |
|R.......u |
|          |
+----------+
```
## 11: 4-Way Knot
```
+----------+
|      D   |
|          |
|   r      |
|R    d    |
|          |
|    u    L|
|      l   |
|          |
|   U      |
+----------+
+----------+
|    * D   |
|    . .   |
|   r.....*|
|R....d.   |
|   ....   |
|   .u....L|
|*.....l   |
|   . .    |
|   U *    |
+----------+
```
## 12: Busy Junctions
```
+----------+
|rrrrr rrrd|
| rlrl     |
|ul rrd    |
|ruX X     |
|udl ll    |
|ull       |
|rlr       |
|rdr  d    |
|Uruull    |
+----------+
+----------+
|rrrrr.rrrd|
|.rlrl    .|
|ul rrd   .|
|ruX.X.   .|
|udl.ll   .|
|ull.     .|
|rlr.     .|
|rdr..d   .|
|Uruull   *|
+----------+
```
## 13: Starts Into Edge
```
+----------+
|   U      |
|          |
|          |
|          |
|          |
|          |
|          |
|          |
|          |
+----------+
+----------+
|   U      |
|          |
|          |
|          |
|          |
|          |
|          |
|          |
|          |
+----------+
```
## 14: Crossing Dead Paths
```
+----------+
|          |
|          |
|          |
|      R   |
|          |
|          |
|          |
|          |
|         U|
+----------+
+----------+
|         *|
|         .|
|         .|
|      R..*|
|         .|
|         .|
|         .|
|         .|
|         U|
+----------+
```
  
[Answer]
# JavaScript (ES6), ~~191 183~~ 181 bytes
*Thanks to @tsh for helping fix a bug*
Takes input as a matrix of characters. Outputs by modifying the input.
```
f=(a,X,Y,d,n=0)=>a.map((r,y)=>r.map((v,x)=>(a+0)[i=' .*dlurDLUR'.indexOf(v),n]?X?X-x+~-d%2|Y-y+(d-2)%2?0:~i?f(a,x,y,i>2?i&3:d,n+1,r[x]=i?v:'.'):n?a[Y][X]='*':0:i>6&&f(a,x,y,i&3):0))
```
[Try it online!](https://tio.run/##vZZtb9owEIC/71eckErikqSMTvuQKUTb2KRtSJ1gaKkQHzycgivXiRybgdb1rzObhFfB6HiZI6Jc7s5@fPHdcY9HOOsLmkqXJySeTu8CGzuRc@sQhwdVFNSx94BT2xbORAsiF0bOWAs2rlRRlwYWeJeEKdFodlqWRzmJxzd39gg5vBdGYeSOK08uuag93rqTik3cGrqohVX/iYZ3eqmxM3FovRbS8rWvl6y8dER33AtoOPItz0I@D3H3tteNeoF1aflVn9Zfl8sLx/I18qsITWWcSQjAllSy2AGCJUYQ1OEX9BOeJSz2WDLItegNaHdtbIy8LGVU2taVhWY7E8ap63me6CFtuOqMlwbCu08oty0LGaPfL16Y5e1Smz6kLC45sDZKFXcxKlePS8XjuYXOXFglKKGCtkUHQwlSCb5KfDCtOC/te5FkmUgwyU5FS7ZplHlgR9O@ghkv5QNIsRwWzFtpG/sWa@3fVPM42o9U6OxpJkl61tiCie7xsW1LLGQsAGfQH2I@iIWhPpi2ed5z25YCzxJtLbynqQnieeH8B9pvM9QvPJGnOAkk51vQqoVQPB9J@5bDzY9M4v5a0T1ZbAGik54EaA9xutkeNmjzKro9faJiGIHk75nRKLZiVtj8pY6oTc32CuZ@x5PnnYTGvobQmu9pawTVegVjh8T2ncom8FnxvqS6Y8@JN2NrBugfMVMKJth8fh1B/bYQhIogWmgIA8YWZmzJpP1XBCKWO@wIpeY@uytYBp@4TOADGcS7ukPnP/1PgP2d13SyRowJfC3a2TFZ1joBbWcHbTPRpMzcfuLJrnrb0N/LXGBOwvwzEjN/kVd5Yh2igTUzlV8R26Sd/gE "JavaScript (Node.js) – Try It Online")
### Commented
```
f = ( a,                           // a[]  = input matrix
      X, Y,                        // X, Y = coordinates of the previous cell
      d,                           // d    = current direction (0 .. 3)
      n = 0                        // n    = number of iterations for the current path
    ) =>                           //
  a.map((r, y) =>                  // for each row r[] a position y in a[]:
    r.map((v, x) =>                //   for each character v at position x in r[]:
      (a + 0)[                     //
        i = ' .*dlurDLUR'          //     i = index of the character
            .indexOf(v),           //     blocking characters '-', '|' and 'X' gives -1
        n                          //     by testing (a + 0)[n], we allow each cell to be
      ]                            //     visited twice (once horizontally, once vertically)
      ?                            //     if it is set:
        X ?                        //       if this is not the 1st iteration:
          X - x + ~-d % 2 |        //         if x - X is not equal to dx[d]
          Y - y + (d - 2) % 2 ?    //         or y - Y is not equal to dy[d]:
            0                      //           ignore this cell
          :                        //         else:
            ~i ?                   //           if this is not a blocking character:
              f(                   //             do a recursive call:
                a,                 //               pass a[] unchanged
                x, y,              //               pass the coordinates of this cell
                i > 2 ? i & 3 : d, //               update d if v is a direction char.
                n + 1,             //               increment n
                r[x] = i ? v : '.' //               if v is a space, set r[x] to '.'
              )                    //             end of recursive call
            :                      //           else (this is a blocking character):
              n ?                  //             if this is not the 1st iteration:
                a[Y][X] = '*'      //               set the previous cell to '*'
              :                    //             else:
                0                  //               do nothing
        :                          //       else (1st iteration):
          i > 6 &&                 //         if v is a capital letter:
            f(a, x, y, i & 3)      //           do a recursive call with this direction
      :                            //     else ((a + 0)[n] is not set):
        0                          //       we must be in an infinite loop: abort
    )                              //   end of inner map()
  )                                // end of outer map()
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~283~~ ~~279~~ ~~293~~ ~~288~~ 279 bytes
```
e=enumerate
def f(M):
 s=[(x,y,c)for y,l in e(M)for x,c in e(l)if'A'<c<'X'];v=set(s)
 for x,y,C in s:
	d=ord(C)%87%5;q=d>1;X,Y=x-d+q*3,y+~-d-q;c=M[Y][X];N=(X,Y,[C,c]['a'<c<'x'])
	if'!'>c:M[Y][X]='.'
	if(c in'-|X')*('/'>M[y][x]):M[y][x]='*'
	if(c in'udlr. *')>({N}<v):v|={N};s+=N,
```
[Try it online!](https://tio.run/##zVdRb9owEH5efoVXqXJiwk10mjZBjTQVVXugncSElorxQDFomVygDqlAY/vrzI6TYKKU0C60GCHy5c72d1/Ol2O2nP@cTs7W6xEdTcK7kRjMRxYbjdHYvnLqFgpoz164S3fojKcCLV2O/AkaSZuCC3eoIXf8Mf6Mz4fn2MP9xgMNRnM7cCykvZbuhfIL6tYbRqeC2RfO6aePpx8a95Q1aw3PvaGLKqvck/fusvK3yqr3jSG96t30e16/cU1t6eD2Ltxhv4cH0SYL3HesN3LPt7g5rMeeFANWN21FCldXHnaIjd/h5lVv2e8t@k49vqCYGI4h4wIQwU7T/n395/zBqT@sqLxqBBV67a6/ffn6ndYiSS7tgXurRBE1ejeY2dwP5u4Aghn35zb@McGOitgWNfkjzjYutxmXmfAnc7UIFWcW8sdI7SGXjdSKBBa1euSEMfya@hOpr6XGpX1yclKppqNirVA6VocG3QSYDCQhN48UMWfC4cBjpJz/VEu8qFr7kgI1yFGqxfIsobrg5apFzJmwA0i1WApAKxGRUiLyA6nVKgq2Uyxqu@yT2DLjgxzQgXiQrIUklvbOBTQp8pK5hVR28dc7iSxfhvBwubUPsfbR1S2ZQe1jrfLZROPHUOWzicaPRC2m9UnVClMQX5esFjGXgUcA0/poAAIMUhAeVW4h5B1fbgHxSsutPLl0G5Vfv714KMD0fa4sITfcYp8dL9IwaymUS7dRMSkdHUmAQQqYfvNtkQKTFJhbg/kiLSL1jBZCbEfOHnvC4XYLwcs5ii3z9EFORxpFzozeQI4NCJMWgkC2@wKTFHmCWkINJL9MzRZc8CQ@@bDk3RiI0ENeamEccZ668Y0mcr4BmNgo3BVhmMwpzi01ICYFCSkwSYEmBR4kFsYh2kC7cZ2SoEkZgMVdB5ikyP651X2hP4roKbn12qRKKPOdEoh1n1LmiTkT8kEnbeZ3uu0E3T3VasnUVB@kkj45RkzFF9d1XdifY0FbbqH@ePvkVkIKIlJxXWYqvriuA4dnWmDLLSFVeBLjR9hK4upuwsiEUODprP8B "Python 2 – Try It Online")
Takes a list of lists.
Outputs by modifying the input array.
[Answer]
# Perl 5, ~~203~~ ~~188~~ 166 bytes
```
$l='\K[ a-z](?=';$t='([-|X])?';$s=$_;/
/;$n='.'x"@-";{$_|=s/(?|R[.*]*$l$t)|$t${l}[.*]*L)|D$n(?:[.*]$n)*$l$n$t)|$t$n$l$n([.*]$n)*U))/$&eq$"?$1?'*':'.':uc$&/es?redo:$s}
```
[TIO](https://tio.run/##zVVNa8JAEL37KxYZ3ESJsYdeEsL24K2ehEDAikg3h8IQ7SYLpa5/vWm2@VCDbcBGzUBg3s7HvrzMbrahwMc0BfToy/OCrK3PpcE86kLiUWNhqWBpsgzFHqxcu2e7EHl0TD/6T1bf3cFKebFtMDVfjIfLISAkpoIEdrj/WZiZagqRwRyNIDJ1RlTkRNo3yoBvmjYMwnfoM3hgdEidbBdHvsLADmMmQr5xIN6nmgil6ciqbNRTpDJ1beCX4IRB71I@ont8@LmI1A62y2fa1G7eTHvWEX2IVghv/71mHZufulh4Xz48Z1DxkRUo/HvrQ0hwBX3yW@X8oAaFacDzddQRiUdpRc4fZ1LWIxefd3Ham/@mgjw97/gffbSR7OG6SKDAskOmQrZaACEDElQRjgSxSsPDrln9EeDi8A6@kLKsadDHv9H/i7Q@z/MW@Pg1Pl@bbfK2ieLU2k4m3w)
How it works
* `$s=$_` to save input into `$s` to restore lowercase changers. `$_|=$s` because bitwise or with space  will not change `.` and `*`, lowercase letters `urld` will be restored with bitwise or operation.
* `/\n/;$n='.'x"@-"` to get "width" and `$n` to match any character "width" times
* `$l='\K[ a-z](?=';$t='([-|X])?'` to reduce regex length ; `$l` to match a lowercase letter `urld` or a space on a path, `$t` to match a terminator.
After replacement : `(?|
R[.*]*\K[ a-z](?=([-|X])?)
|
([-|X])?\K[ a-z](?=[.*]*L)
|
D$n(?:[.*]$n)*\K[ a-z](?=$n([-|X])?)
|
([-|X])?$n\K[ a-z](?=$n([.*]$n)*U)
)` 
* switches `/e` to eval, `/s` so that `.` (inside `$n`) matches also a newline character
* `$&eq$"?$1?'*':'.':uc$&` if matched is a space, if termiator matched `*` otherwise `.` otherwise uppercase.
[Answer]
# [Clean](https://github.com/Ourous/curated-clean-linux), 409 bytes
```
import StdEnv,Data.List
q=flatlines
$m=foldl(zipWith\a b|a=='*'||b=='*'='*'=max a b)(q m)[q(foldl(\m(_,y,x)=[[if(b<>x||a<>y)if(k=='*')'.'k'*'\\k<-r&b<-[0..]]\\r<-m&a<-[0..]])m(last(takeWhile(not o hasDup)(inits(f 0y 0x)))))\\l<-m&y<-[0..],c<-l&x<-[0..]|isUpper c]
where f a y b x=let(u,v)=(a+y,b+x)in(case toLower((m!!u)!!v)of' '=[((a,b),u,v):f a u b v];'r'=f 0u 1v;'l'=f 0u -1v;'u'=f -1u 0v;'d'=f 1u 0v;_=[])
```
[Try it online!](https://tio.run/##hZNRa6swFMef66c4XUdNbrXrXjctXOh9GBR2YYwNVEbUuIYm2sbY6ua@@vUm2pZxX24gnPxyzv@fEyUJpyTvRJFWnIIgLO@Y2BVSwZNKf@UHZ0UUma9Zqay9n3GiOMtpaV0LPyt4ytEH270wtQkJxC3xffuH3bZxH/spSA06hdEeBA72aBCFAr05jVNjPwhYhmJvWbct8ZYN1rTt1die21sdw3DruXIae26wmM@jKAyl54opOTMWiJNSIUW29GXDOEV5oaCADSlX1Q4jljNVogwWDSxqbEYYcuPQnBycxHP5tD5Ry8rn3Y5KSCLruKGSQqb7byCG2udUoco5YB@RWePEsxqzHCWkpKCKdXGkEiExHld4PD7gIrPB9gOEiBNjx6jujFGljQ7RvS1tX7dUwe3h3uantWugMuDeVrDQkBoY1m9@EOHLn2lKRcX84dF6UkTz0RpNAPU/xoEjBh8kJelPztdmy6RvbibQ53Xuc/I5ScLQXFvvfOnPocMA5Zc18uF6KB3ub43@9TqfdTqKHgh/eIR3qkxFX9D2BuAt4epK4/@aG@kzURAkEIaQgOfe9fJoCGVkVL1poXRDR1bSs6RPdTP3MmZWK80APdPWakFyycEMDRXX2@kJZPUKr5dMyoHzS9mgGMq4/AaphrPBs6yqs@Z7B38S/Ujey859WHerJieCJQP81m8nK6To3Pgv "Clean – Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), 250 bytes
```
def f(G,e=enumerate):
 for i,k in e(G):
	for j,l in e(k):
	 v=X=x=y=m,=l,
	 while(m in'-X|')<(l in'DLRU')>(X in v):v+=X,;y,x=zip((1,0,0,-1,y),(0,-1,1,0,x))['DLRU dlru'.find(m)%5];G[i][j]=(m,'.*'[G[i+y][j+x]in'-X|'])[m<'!'];i+=y;j+=x;X=x,i,j;m=G[i][j]
```
[Try it online!](https://tio.run/##nVJRa8IwEH6evyJ7GJcsp8zBXqzZ00CEPQ2EQsjDoCmmJrWU1rXD/96lTpwd2ukIfNx9uS/33ZGsLpbr9LFpIh2TmM5QC52WTufvhWaTAYnXOTG4IiYlms48c9MyCdpvZtUyZCNCUYlaOBQWff6xNFZT50tgGG6BTWlbDi@vbwtgzzRstRs22XARYlBjJT5NRukYH/wZjrFmSHdBy1SMyZ2SRDYvYRSbNKKO3T2pYCaNkokS1CGM7kH6nNee4ZXad1ZMuincggoMF3WQcFEF3ioaTAIn9vpmLkyalQVlg5jO2SDLTVqQeSMlcEACw6uBg0IiYdvG@TkgJ7iohe2R@qfIdiNyDo7VZbf8V5@/1PnhifBwH17XO@oasL32Tzvvn7bHue1u@kp1dEJ90dYW3dWVF8/9/7@mvgA "Python 2 – Try It Online")
Takes a list of lists of 1-char strings, as explicitly allowed by the OP.
Changes the list in place.
For easier I/O, use [this](https://tio.run/##TZBda8MgGIWvl1/hLoY6bdgKvUnqrgalsKtBIZAJLWioqdpgki6O/PdM@0VfUTyP5/jV@G5/tPNpErICFVpRyaTtjXS7TuIsAdXRAUUPQFkg0SqQp0hqqi/kEAk4sYINzDNDmaZB/@6VlsgEC5wVI8RLFO3w8@t7A/EHKmL2hLMTYQXNPR3Yn2oQeqdvoc3eqccUnSeRDBiX5yQQ2vUwrZQVyOCXBc9XpeJlzRkyFKavsAya@EDIwK8nc1yaJXyGPFeE@bwmbMjDVamidW7YNT8p0xxdB1rfJmtmdg3Squ1okGnbCWVTJ3cC4bRttOoQ/LEQ46RC6zDEz4mPWWeNU7bbqm05z7IFn8jsXiQZXSwQuhiTETjtNIgVRK8DFlfh@gIU9xWhgdZ32yVxsWn3IEQQtw02ru9vmccb/AM).
]