Question: I have bundle `A.jar` installed in OSGi and I can get this bundle using BundleContext 

`Bundle bundleA = context.getBundle()`

And a specific classloader B

How can I adding all class from `bundleA` to my classloader B

Answer: 
If you want to use regular expressions you can find all the occurrences of:

```
(\S.*?\.\S+)

```

(you can test it [here](http://regex101.com/r/uW1aR5/1))
If there are spaces in the file names, it makes it trickier. 

If you can assume there are no dots (.) in the file names, you can use the dot to find each individual records as has been suggested.

If you can't assume there are no dots in file names, e.g. my file.new something.txt 

In this situation, I'd suggest you create a list of acceptable extentions, e.g. .doc, .jpg, .pdf etc.

I know the list may be long, so it's not ideal. Once you have done this you can look for these extensions and assume what's before it is a valid filename.