Question: I am working with a label and form which I want to center in the row, but encountering difficulties to do that. The label wont move to center next to the input field without moving the field down. This is the code:

```
<div class="row"> 
            <div class="col-md-6">
                <div class="form-group">
                    <label class="col-md-6 control-label pull right">Password: </label>
                    <div class="col-md-6">
                        <input type="text" name="Password" class='form-control'  />
                    </div>
                </div>
            </div>
    </div>

```

Answer: 
In the responses below we use this test data:

```
# test data
v1 <- c("Pic 26 + 25", "Pic 27 + 28", "Pic 28 + 27", "Pic 29 + 30", 
"Pic 30 + 29", "Pic 31 + 32")

```

**1) gsubfn**

```
library(gsubfn)

strapply(v1, "(\\d+).*", as.numeric, simplify = c)
## [1] 26 27 28 29 30 31

```

**2) sub** This requires no packages but does involve a slightly longer regular expression:

```
as.numeric( sub("\\D*(\\d+).*", "\\1", v1) )
## [1] 26 27 28 29 30 31

```

**3) read.table** This involves no regular expressions or packages:

```
read.table(text = v1, fill = TRUE)[[2]]
## [1] 26 27 28 29 30 31

```

In this particular example the `fill=TRUE` could be omitted but it might be needed if the components of `v1` had a differing number of fields.
With `str_extract` from `stringr`:

```
library(stringr)

vec = c("Pic 26 + 25", "Pic 27 + 28", "Pic 28 + 27", 
        "Pic 29 + 30", "Pic 30 + 29", "Pic 31 + 32")

str_extract(v1, "[0-9]+")
# [1] "26" "27" "28" "29" "30" "31"

```